Set datePicker's minimumDate in viewDidLoad


I dont understand why we cant set minimumDate in viewDidLoad? If view controller’s view was destroyed by sending viewDidUnload, it will be loaded again by sending loadView and then viewDidLoad where we can set minimumDate without worrying!


Thanks for a genius picture of UIView life cycle! :slight_smile:


True…but that’s not the only case being addressed by setting minimmDate in -viewWillAppear.

Remember that this app has TWO views: one from HypnosisViewController, and the other from ReminderViewController.

We added NSLog() statements to -viewDidLoad in both view controllers on page 136. Run the app again. (It starts with the Hypnosis view.) Switch to the Reminder view. Switch back to the Hypnosis view. Wait a couple of minutes (you’re being hypnotized, right? :wink: ) then switch back to the Reminder view.

Note that the log shows the ReminderViewController method -viewDidLoad being run only once, when we switched to it right after launch.

So now, if the minimum date is set in -viewWillAppear (as in the book), you won’t be able to set a past time for another 60 seconds or so. But if you had set the minimum date in -viewDidLoad, you could set it to a past time immediately.

By the way…what’s the translation for the block written in Cyrillic?