What is the correct way of handling a reloaded view after it was dismissed?
I have the same problem as the guy here: UIImagePickerController reloads view after its dismissed?
I have a UIView with a UIDatePicker within a Popover. When the Popover is dismissed and presented again, it sometimes resets the Picker in the view because hidden views are unloaded when a memory warning occurs.
This is the part displaying the view:
endCompareDateTimePicker.picker.maximumDate = [NSDate dateWithTimeIntervalSinceNow:0];
[endCompareDateTimePopover presentPopoverFromRect:sender.frame inView:self.view permittedArrowDir开发者_如何转开发ections:UIPopoverArrowDirectionAny animated:YES];
The picker (IBOutlet UIDatePicker) does not stay initiated. Adding a [endCompareDateTimePicker loadView]
helped out and got me the picker initiated to set the correct date values before displaying the view.
While this is working, I dont think this is the proper way doing this.
What would be the correct way to handle this situation?
Your above code for configuring the DatePicker should be in the -viewDidLoad
method of whichever ViewController owns the date picker (ie the View Controller that manages what's inside your popup).
精彩评论