Well, I figured out the issue.
Ends up that the super
method is alright, the problem lies on a UINavigationController
subclass that I made that forwards the call to this view controller.
To fix it, I added a protocol that any view controller can implement, and basically asks if it wants to take care of the unwind segue, or it should be done automatically by the navigation controller.
It's very verbose, but I think it's better than the solution posted prior to the edit.
FKNavigationController.h
/**
* Implement this if you want custom unwind segues
*/
@protocol FKNavigationControllerSegueForwarding <NSObject>
- (BOOL)shouldPerformUnwindSegueFromNavigationControllerWithIdentifier:(NSString*)identifier fromViewController:(UIViewController*)viewController;
@end
/**
* Automatically forwards segue methods
*/
@interface FKNavigationController : UINavigationController
@end
FKNavigationController.m
@implementation FKNavigationController
- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifier
{
if ([toViewController respondsToSelector:@selector(shouldPerformUnwindSegueFromNavigationControllerWithIdentifier:fromViewController:)])
{
if ([(id<FKNavigationControllerSegueForwarding>)toViewController shouldPerformUnwindSegueFromNavigationControllerWithIdentifier:identifier fromViewController:fromViewController])
{
return [toViewController segueForUnwindingToViewController:toViewController fromViewController:fromViewController identifier:identifier];
}
}
return [super segueForUnwindingToViewController:toViewController fromViewController:fromViewController identifier:identifier];
}
@end
Updated View Controller
#pragma mark - Segue forwarding
- (BOOL)shouldPerformUnwindSegueFromNavigationControllerWithIdentifier:(NSString *)identifier fromViewController:(UIViewController *)viewController
{
if ([identifier isEqualToString:@"camera.take.close"])
{
return YES;
}
return NO;
}
- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifier
{
// Check the FKNavigationControllerSegueForwarding if you want to add more.
if ([identifier isEqualToString:@"camera.take.close"])
{
// Circular segue!
FKCircularSegue *segue = [[FKCircularSegue alloc] initWithIdentifier:identifier source:fromViewController destination:toViewController];
segue.frameCircle = _frameCameraButtonTapped;
segue.unwind = YES;
return segue;
}
return [super segueForUnwindingToViewController:toViewController fromViewController:fromViewController identifier:identifier];
}