Segue Popover won't behave properly

Posted by CStreel on Stack Overflow See other posts from Stack Overflow or by CStreel
Published on 2012-01-13T02:46:25Z Indexed on 2012/07/06 9:16 UTC
Read the original article Hit count: 684

Filed under:
|
|

I'm trying to use Segue to present then dismiss a Popover view a UIBarButtonItem is clicked.

I've created a generic Segue that is not anchored to anything but the view and given it a name

I've Anchored the UIBarButtonItem in the Interface Builder to:

- (IBAction)clickedSettings:(id)sender {

    if(self.popSegue != nil) {
        [self.popSegue.popoverController dismissPopoverAnimated:YES];
    } else {
        //Current says only a button may
        [self performSegueWithIdentifier:@"Settings" sender:sender];
    }
}

But when ever i click the button to display the Segue it gives me an error:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIStoryboardPopoverSegue must be presented from a bar button item or a view.'

It doesn't even hit my -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

I've read the following questions on stack:

  1. iOS:How to dismiss Popover
  2. UIBarButtonItem + popover segue creates multiple popovers

But i still get the same error. For the life of me i can't figure out what is going wrong

© Stack Overflow or respective owner

Related posts about ios

Related posts about uistoryboard