开发者

Get UIDatePicker variable from another view

开发者 https://www.devze.com 2023-01-08 10:47 出处:网络
I\'m sure I have something dumb wrong, but I\'m trying to pass the data set in a UIDatePicker from one view to another (I\'m using the Utility Template in Xcode).

I'm sure I have something dumb wrong, but I'm trying to pass the data set in a UIDatePicker from one view to another (I'm using the Utility Template in Xcode).

I've written out all of the pertinent code below.


FlipsideViewController.h

@interface FlipsideViewController : UIViewController {
    IBOutlet UIDatePicker *datePicker;
}

@property(nonatomic, retain) IBOutlet UIDatePicker *datePicker;

FlipsideViewController.m

@synthesize datePicker;

mainViewController.m

NSDate *time = flipsideViewController.datePicker.date;

Logging time returns null.

Also, I'm posi开发者_开发知识库tive I've properly linked datePicker to the UIDatePicker element in Interface Builder.

Thanks!


flipsideViewController.datePicker.date may not exist by the time you go back to mainViewController. You need to set it before you release or return from the FlipViewController view.

0

精彩评论

暂无评论...
验证码 换一张
取 消