0

以下に示すように、datepicker.date を DatePickerPopupViewController から SensorvViewcontroller に渡したいと思います。ただし、「null」が返されます。私は何を間違っていますか?私のコードは次のとおりです。

#import "DatePopoverViewController.h"

@interface DatePopoverViewController ()

@end

@implementation DatePopoverViewController
@synthesize datePicker;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    datePicker.date=[NSDate date];
}



@end

#import "SensorViewController.h"

@interface SensorViewController ()

@end
// this represent my button which triggers popupViewController

-(void)chooseDate
{

    if([popoverController isPopoverVisible])
    {
    [popoverController dismissPopoverAnimated:YES];

    }
    else
    {
        CGRect popRect=CGRectMake (900,1,1,1);
        //CGRect popRect=CGRectMake (tools.frame.origin.x,tools.frame.origin.y,50,50);
        popoverController.popoverContentSize =CGSizeMake(320,216);
        [popoverController presentPopoverFromRect:popRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
        datepop=[[DatePopoverViewController alloc]init];
        NSDate *ali= datepop.datePicker.date;
        NSLog(@"%@",ali);
    }

}

   @end

ここに画像の説明を入力

4

2 に答える 2