unwind segue on navigation pop
unwind segue on navigation pop
- Subject: unwind segue on navigation pop
- From: Roland King <email@hidden>
- Date: Fri, 13 May 2016 10:48:03 +0800
I’m making more use of unwind segues to try and get to the point I have ‘go forward’ and ‘go backward’ code in one place in the same class. So during prepareForSegue I set some stuff up, during my unwind segue method I tear it down again. Don’t use it for everything, but for some complex presentations it’s been quite useful.
I’ve just changed a piece of navigation to use a standard nav controller, it used to be a modal presentation but a push makes more sense. So now there’s no custom dismiss button like there used to be, you go back with the normal back button on the nav controller. I can’t find a good way to get that back action to trigger my unwind segue. Can’t seem to do it in IB, I don’t want a custom back button because you lose the chevron (or have to fake it) and all the normal uinav behaviour.
Best I’ve found so far is to give the segue a custom identifier (ie make it a viewcontroller segue) and performSegue it from ‘viewWillDisappear’, however that has a pretty bad smell about it because that’s not really an unwind, it’s already doing the dismissal by then. Feels like something which is going to break one day.
There’s other ways I can do this obviously - change it to a protocol/delegate method called directly from the VC as it goes away, but I was trying to stick with unwind segues if possible.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden