Skip to content

Instantly share code, notes, and snippets.

@spotlessicode
Created November 12, 2014 15:19
Show Gist options
  • Save spotlessicode/9969c0b5a1a0e20fdaac to your computer and use it in GitHub Desktop.
Save spotlessicode/9969c0b5a1a0e20fdaac to your computer and use it in GitHub Desktop.
#import "MyNavController.h"
#import "MyCustomUnwindSegue.h"
@interface MyNavController ()
@end
@implementation MyNavController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifier
{
//how to set identifier for an unwind segue:
//1. in storyboard -> documento outline -> select your unwind segue
//2. then choose attribute inspector and insert the identifier name
if ([@"UnwindFromSecondView" isEqualToString:identifier]) {
return [[MyCustomUnwindSegue alloc] initWithIdentifier:identifier source:fromViewController destination:toViewController];
}else {
//if you want to use simple unwind segue on the same or on other ViewController this code is very important to mix custom and not custom segue
return [super segueForUnwindingToViewController:toViewController fromViewController:fromViewController identifier:identifier];
}
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment