Reputation: 2062
This issue seems to be new with iOS 8, as I had this setup working in iOS 7 and it just started causing problems when I updated.
In Interface Builder, if I have a UIBarButtonItem
that triggers a Show (Push) segue to another View Controller and is also connected to an action, the segue happens but the action is never called. If I try this with a regular button, both the segue and action are called. This happens with UIBarButtonItem
s both when they are in the Navigation Bar and in a standalone UIToolBar
Could anyone explain why this might be happening/offer a possible fix? Thanks
Upvotes: 0
Views: 239
Reputation: 9362
I think the preferred way to do this is to implement prepareForSegue in your view controller:
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
if (segue.identifier == "MySegueIdentifier") {
// pass data to next view
}
}
Where "MySegueIdentifier" is the name of the segue in your storyboard.
Upvotes: 1
Reputation: 3558
A fix would be to create a manual segue and call it from your action using -(void)performSegueWithIdentifier: sender:
Upvotes: 2