2

I am planning to create UI Popver element with a text entry and buttons similar to http://www.ofzenandcomputing.com/wp-content/uploads/2011/01/enter-password.png

Clicking elsewhere on the screen should not dismiss the popover and only the cancel or save button should dismiss the popover.

Does the iPad password setup screen use UIPopoverController ? How do I enforce the popover from being dismissed ONLY from a cancel button in the pop up ?

Dave G
  • 21
  • 1

2 Answers2

0

That is indeed a UIPopover. On iOS versions prior to 3.2, UIPopover contains a property called passThroughViews. Pass an NSArray with self.view as the sole object to that method and your popover will not dismiss when the view is tapped.

CodaFi
  • 43,043
  • 8
  • 107
  • 153
  • [related question](http://stackoverflow.com/questions/5477422/is-there-a-way-not-to-have-the-popover-dismissed-when-pressing-outside-it) – Dave G Apr 18 '12 at 02:00
  • another related question - http://stackoverflow.com/questions/3627926/uipopover-locking-background-view – Dave G Apr 18 '12 at 02:13
0

Yes, you can by using popoverView's delegate:

-(BOOL)popoverControllerShouldDismiss:(UIPopoverController *)popoverController
{
    if ([save or cancel button is tapped]) {
        return YES;
    }
    return NO;
}
Sebastian Brosch
  • 42,106
  • 15
  • 72
  • 87
Son Nguyen
  • 3,481
  • 4
  • 33
  • 47