如何发送NSDate到另一个视图 [英] how to send a NSDate to another view
问题描述
如何向另一个视图发送 NSDate
对象?
How do I send a NSDate
object to another view?
日历( Si-Calendar )并将其用于另一个视图...
Trying to get the selected date form a calendar (Si-Calendar) and use it into another view...
推荐答案
查看GitHub上的README文件,所选日期中的更改将发送到您设置为CalendarViewController对象的委托的对象。将调用的方法是:
Looking at the README file on GitHub, changes in the selected date will be sent to the object you set as delegate for the CalendarViewController object. The method that will be called is:
- (void)calendarViewController:(CalendarViewController *)aCalendarViewController dateDidChange:(NSDate *)aDate
如果你想将该日期传递给一个新的viewController, c $ c> NSDate 属性,假设它的名称为 date 。然后,您可以将此日期传递给另一个viewController(我们称之为 otherViewController ):
If you then want to pass that date on to a new viewController, make sure it has an NSDate
property, let's say it goes by the name date. You can then pass the date to the other viewController (let's say it's called otherViewController) this way:
otherViewController.date = aDate;
这是一个通过viewControllers传递对象的正常方法,你可以这样做任何类型的对象。基本的成语是:
This is a normal way of passing objects through viewControllers, you'd do it like this for any type of object. The basic idiom is:
- 在viewController中有一个想要传递的对象类型的属性, li>
- 设置属性。如果使用
retain
或strong
关键字定义,则会被保留。
- Have a property of the type of object you want to pass in the viewController you want to pass it to
- Set the property. If it was defined with the
retain
orstrong
keyword, it'll be retained.
这就是!
希望这有助于
That's all! Hope this helps
这篇关于如何发送NSDate到另一个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!