Thursday, April 4, 2013

Handling Popover Controllers During Orientation Changes

Van egy azonos cimu bejegyzes az Apple-nel ami szerint:

When showing a popover controller, there are times when you will need to handle how the popover controller appears after a change in device orientation.

Situations when handling is required:

If the popover controller is presented from a target rectangle using the –presentPopoverFromRect:inView:permittedArrowDirections:animated: method of UIPopoverController.
If the popover controller is presented from a bar button item that is removed after the rotation has finished.

es ilyenkor a megoldas, ha ujra meghivjuk a presentPopoverFromRect:inView:permittedArrowDirections:animated: method-ot a didRotateFromInterfaceOrientation: eventben, csak azt nem teszik hozza, hogy elotte azert erdemes megnezni, hogy egyaltalan latszott-e a Popover Controller. Szoval helyesen igy nez ki:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
if ([myickerPopover isPopoverVisible]) {
[[self myPickerPopover] presentPopoverFromRect:
[[self myButton] frame] 
inView:[self view] 
permittedArrowDirections: UIPopoverArrowDirectionAny animated:YES];
}
}

Felteve, hogy a myPickerPopover es a myButton elerheto property.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.