Reputation: 33
I am using XCode 4.2 storyboards. Originally I had a Popover Segue anchored to a UIButton on a UIViewController embedded in a Navigational controller and all was well.
Now I need to add conditional behavior before performing the segue so I did the following:
[self performSegueWithIdentifier:@"mySegue" sender:self]
in the IBAction The app gets through prepareForSegue but then it throws a SIGABRT and logs the following
\*** Assertion failure in -[UIStoryboardPopoverSegue perform], /SourceCache/UIKit_Sim/UIKit-1912.3/UIStoryboardPopoverSegue.m:27
Any ideas? I have other instances of this working fine with push segues. Is this a case of misbehaving popovers that I keep on hearing reference to?
Upvotes: 3
Views: 2296
Reputation: 246
Maybe it's a bit late:
The anchor defines the starting point of the popover that you want to show and is not connected to an action. It must be set.
So when you want to call the popover segue programmatically, you have to do it in two steps:
1. Connect the Segue to the ViewController You simply drag from your ViewController that should perform the segue to the destination ViewController and select Popover.
2. Define the identifier This is necessary to call perform the segue from your code
3. Connect the Anchor You drag the anchor to the Object from which you want the popover to start from. In the image below it's a BarButtonItem. Note: this does not automatically perform the segue! (This way you can additionally perform some actions connecting to the BarButtonItem)
4. Call the segue from your code
[self performSegueWithIdentifier:@"yourIdentifier" sender:sender];
Upvotes: 10