Unwind segues

  • Where are these documented?

    I found some information on Stackoverflow. I put an -unwind: method in the same controller as the one that contains the button that's connected to the exit. IB allows me to connect to this unwind: method, but it never calls it at run time.

    I tried putting a method in the destination view controller, and it allows me to connect to that one, too, but it also never gets called.

    What am I missing?

    TIA,

    --
    Rick
  • Looks Iike the closest I can find is within the UIViewController. I searched all the frameworks of iOS 6.0 using Dash and Xcode 4.6.1.

    If it is an IBOutlet, then this is your method.  You need to create it.

    Sent from my iPad

    On Apr 30, 2013, at 4:13 PM, Rick Mann <rmann...> wrote:

    > Where are these documented?
    >
    > I found some information on Stackoverflow. I put an -unwind: method in the same controller as the one that contains the button that's connected to the exit. IB allows me to connect to this unwind: method, but it never calls it at run time.
    >
    > I tried putting a method in the destination view controller, and it allows me to connect to that one, too, but it also never gets called.
    >
    > What am I missing?
    >
    > TIA,
    >
    > --
    > Rick
  • On Apr 30, 2013, at 13:56 , Alex Zavatone <zav...> wrote:

    > Looks Iike the closest I can find is within the UIViewController. I searched all the frameworks of iOS 6.0 using Dash and Xcode 4.6.1.
    >
    > If it is an IBOutlet, then this is your method.  You need to create it.

    Hey, Alex, thanks. I'm not sure I understand what you're telling me. I created (two) methods, - (IBAction) unwindFoo: and - (IBAction) unwindBar: in two different UIViewController subclasses. Both can be connected to, neither gets called.

    --
    Rick
  • Are you expecting these to be called when a segue unwinds because I can. Of see these declared in any of the docs.  If something calls an IBAction, these are generally attached to an IBOutlet (a button) and are triggered on touchUpInside, so they need to be wired up to the button.

    I hope I am understanding you correctly.

    Sent from my iPad

    On Apr 30, 2013, at 4:58 PM, Rick Mann <rmann...> wrote:

    >
    > On Apr 30, 2013, at 13:56 , Alex Zavatone <zav...> wrote:
    >
    >> Looks Iike the closest I can find is within the UIViewController. I searched all the frameworks of iOS 6.0 using Dash and Xcode 4.6.1.
    >>
    >> If it is an IBOutlet, then this is your method.  You need to create it.
    >
    > Hey, Alex, thanks. I'm not sure I understand what you're telling me. I created (two) methods, - (IBAction) unwindFoo: and - (IBAction) unwindBar: in two different UIViewController subclasses. Both can be connected to, neither gets called.
    >
    > --
    > Rick
    >
    >
    >
  • On Apr 30, 2013, at 14:15 , Alex Zavatone <zav...> wrote:

    > Are you expecting these to be called when a segue unwinds because I can. Of see these declared in any of the docs.  If something calls an IBAction, these are generally attached to an IBOutlet (a button) and are triggered on touchUpInside, so they need to be wired up to the button.
    >
    > I hope I am understanding you correctly.

    The button is connected to the "EXIT" bit in the Storyboard. When you do that in IB (control-click on the button, drag to the green EXIT thign at the bottom), then it pops up a menu presenting you with all the -unwindXXX: methods available. I choose one of those. But it never gets called.

    --
    Rick
  • Odd.  I've never played around with the exits yet.  If you hook it up to a UIButton and trigger is manually with a tap, does it get called?

    Try that and set a breakpoint on it and see if there is a clear call chain.  If it doesn't appear in the execution chain, then it might be one of those hard to spot issues on your part.

    If the project is small and you don't mind, you could mail it to me offlist and I could take a peek.

    Lemmie know.

    On Apr 30, 2013, at 5:17 PM, Rick Mann wrote:

    >
    > On Apr 30, 2013, at 14:15 , Alex Zavatone <zav...> wrote:
    >
    >> Are you expecting these to be called when a segue unwinds because I can. Of see these declared in any of the docs.  If something calls an IBAction, these are generally attached to an IBOutlet (a button) and are triggered on touchUpInside, so they need to be wired up to the button.
    >>
    >> I hope I am understanding you correctly.
    >
    > The button is connected to the "EXIT" bit in the Storyboard. When you do that in IB (control-click on the button, drag to the green EXIT thign at the bottom), then it pops up a menu presenting you with all the -unwindXXX: methods available. I choose one of those. But it never gets called.
    >
    > --
    > Rick
    >
    >
    >
  • On Apr 30, 2013, at 14:21 , Alex Zavatone <zav...> wrote:

    > Odd.  I've never played around with the exits yet.  If you hook it up to a UIButton and trigger is manually with a tap, does it get called?

    Yes, that's how I had it before. I just wanted to try the "new" way.

    > Try that and set a breakpoint on it and see if there is a clear call chain.  If it doesn't appear in the execution chain, then it might be one of those hard to spot issues on your part.

    I can certainly connect to IBActions in the current view controller. But the implication online is that this mechanism allows calling actions in parent view controllers, but it doesn't seem to work at all.

    > If the project is small and you don't mind, you could mail it to me offlist and I could take a peek.

    Unfortunately, it's company work, and it's not small any more. :-)

    --
    Rick
  • Oh! I think I found the problem. Looks like I might have to implement

    - (BOOL)canPerformUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)sender

    which seems rather lame; the default behavior to return YES would be helpful.

    On Apr 30, 2013, at 14:21 , Alex Zavatone <zav...> wrote:

    > Odd.  I've never played around with the exits yet.  If you hook it up to a UIButton and trigger is manually with a tap, does it get called?
    >
    > Try that and set a breakpoint on it and see if there is a clear call chain.  If it doesn't appear in the execution chain, then it might be one of those hard to spot issues on your part.
    >
    > If the project is small and you don't mind, you could mail it to me offlist and I could take a peek.
    >
    > Lemmie know.
    >
    > On Apr 30, 2013, at 5:17 PM, Rick Mann wrote:
    >
    >>
    >> On Apr 30, 2013, at 14:15 , Alex Zavatone <zav...> wrote:
    >>
    >>> Are you expecting these to be called when a segue unwinds because I can. Of see these declared in any of the docs.  If something calls an IBAction, these are generally attached to an IBOutlet (a button) and are triggered on touchUpInside, so they need to be wired up to the button.
    >>>
    >>> I hope I am understanding you correctly.
    >>
    >> The button is connected to the "EXIT" bit in the Storyboard. When you do that in IB (control-click on the button, drag to the green EXIT thign at the bottom), then it pops up a menu presenting you with all the -unwindXXX: methods available. I choose one of those. But it never gets called.
    >>
    >> --
    >> Rick
    >>
    >>
    >>
    >

    --
    Rick
  • OK.  Here's an idea.

    Try a simple case.

    Create an empty app with a nav controller and a button to segue to another screen.  Then one more to do the same.  Set up a simple case where your method should get triggered on an exit case and see if it does in a simple, easily trashable file that you don't care about at aii.

    It's approaches like that that most always end up helping me work through the sticky issues.

    GL.

    On Apr 30, 2013, at 5:23 PM, Rick Mann wrote:

    >
    > On Apr 30, 2013, at 14:21 , Alex Zavatone <zav...> wrote:
    >
    >> Odd.  I've never played around with the exits yet.  If you hook it up to a UIButton and trigger is manually with a tap, does it get called?
    >
    > Yes, that's how I had it before. I just wanted to try the "new" way.
    >
    >> Try that and set a breakpoint on it and see if there is a clear call chain.  If it doesn't appear in the execution chain, then it might be one of those hard to spot issues on your part.
    >
    > I can certainly connect to IBActions in the current view controller. But the implication online is that this mechanism allows calling actions in parent view controllers, but it doesn't seem to work at all.
    >
    >
    >> If the project is small and you don't mind, you could mail it to me offlist and I could take a peek.
    >
    > Unfortunately, it's company work, and it's not small any more. :-)
    >
    >
    > --
    > Rick
    >
    >
    >
  • On Tue, 30 Apr 2013 13:13:47 -0700, Rick Mann <rmann...> said:
    > Where are these documented?

    Here!

    http://www.apeth.com/iOSBook/ch19.html#_unwind_segues

    :)

    m.

    --
    matt neuburg, phd = <matt...>, <http://www.apeth.net/matt/>
    A fool + a tool + an autorelease pool = cool!
    Programming iOS 6! http://shop.oreilly.com/product/0636920029717.do
previous month april 2013 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
Go to today