Instance Method

canPerformUnwindSegueAction:fromViewController:sender:

Called on a view controller to determine whether it responds to an unwind action.

Declaration

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

Parameters

action

The unwind action to invoke on your view controller.

fromViewController

The view controller that initiated the unwind action.

sender

The object that triggered the action.

Return Value

YES if the view controller handles the unwind action, otherwise NO.

Discussion

When an unwind segue is triggered, UIKit uses this method and the allowedChildViewControllersForUnwindingFromSource: method to locate a suitable view controller to handle the unwind segue.

The default implementation of this method returns YES when the current view controller implements the action method and is not the same view controller as the one in the fromViewController parameter. You can override this method as needed to change the default behavior. For example, you might return NO if the current view controller does not make a suitable return target when unwinding from the specified view controller.

See Also

Performing Segues

- shouldPerformSegueWithIdentifier:sender:

Determines whether the segue with the specified identifier should be performed.

- prepareForSegue:sender:

Notifies the view controller that a segue is about to be performed.

- performSegueWithIdentifier:sender:

Initiates the segue with the specified identifier from the current view controller'€™s storyboard file.

- allowedChildViewControllersForUnwindingFromSource:

Returns an array of child view controllers to search for an unwind segue destination.

- childViewControllerContainingSegueSource:

Returns the child view controller that contains the source of the unwind segue.

- unwindForSegue:towardsViewController:

Called when an unwind segue transitions to a new view controller.