Search code examples
ioscocoa-touchuiviewuiviewcontrolleruipopover

Detect UIPopover resize event


In iOS I am displaying some content within a UIView in a UIPopover. Sometimes the popover resizes when the keyboard is shown. Is there a specific event for the UIView that I can use to resize the subviews etc? If not, what is the best way to detect the resize event?


Solution

  • You'll probably have to detect this in a delegate method of what ever calls up the keyboard, for example if it's a UITextField something like - (void)textFieldDidBeginEditing:(UITextField *)textField

    Another option as described in this post is to use a UIKeyboardListener to list for notifications about wether or not the keyboard is visible.

    UIPopoverController unfortunately only has two delegate methods and they pertain to the pop over dismissing.

     - (void)popoverControllerDidDismissPopover:(UIPopoverController
       *)popoverController
     - (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController