On Wed, Apr 15, 2015, at 07:18 AM, Gerriet M. Denkmann wrote: > > While my iPhone can use the “DoSomethingAndGoBackToMasterView” button > fine, > the same button does nothing for iPad. > > Of course iPad does not need an unwinding segue - both master and detail > view are always visible (at least in landscape orientation). But the > “DoSomething” part is still needed. > > Currently the button has a Triggered Segue (used on iPhone) and a Sent > Action - obviously ignored, because of the segue. > > So the idea: if the app starts on iPad, I could just clear the Triggered > Segue and the Sent Action would be used. > But how? UIBarButtonItem has nothing about segues.
Correct; you can't manipulate segue definitions at runtime. > > Can this be done? Or is there a better way to make my button work both > for iPhone and iPad? Well, my first question is: can you just put your work in the implementation of the unwind selector? The unwind itself will be a no-op if the split view controller is not collapsed, but the runtime should still invoke your unwind selector. If it doesn't, that's a bug, and you should file a Radar and send me the number. But while I'm here, I figure I should share some little-known knowledge: segues do not need to be attached to a control at all. A segue is actually defined by its source and destination view controllers, not by any controls that invoke it. To create a "manual segue" (that is, one which must be invoked in code, rather than by any button action): 1. In the Document Outline on the left side of the storyboard editor, expand the Master and Detail scenes 2. Control-drag from the Detail scene's view controller to the Master scene's Exit proxy. 3. Choose the unwind selector to create a manual unwind segue that isn't attached to any specific control. 4. On the Properties Inspector for that newly-created segue, give it an identifier. 5. Wire up your bar button item to a method that uses -performSegueWithIdentifier:sender to trigger the unwind. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com