What is the correct way of handling a reloaded view after it was dismissed?

Posted by favo on Stack Overflow See other posts from Stack Overflow or by favo
Published on 2010-05-23T17:22:02Z Indexed on 2010/05/23 17:31 UTC
Read the original article Hit count: 208

Filed under:
|
|

Hi,

I have the same problem as the guy here: http://stackoverflow.com/questions/2682844/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 permittedArrowDirections: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?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about xcode