samedi 29 novembre 2014

Should every segue have it's own action method in the view controller that perform the segue with an identifier?

i'm trying to adopt a system to segue between screens (although I know some times you do things differently).


I have a HompageViewController where I have two menthe buttons in the bottom of the page:


-Create button (go's to another view)


-Stack button (go's to another table view)


in the HompageViewController.m file I have 4 methods:



- (void)unwindFromCreate:(UIStoryboardSegue *)unwindSegue {
NSLog(@"Got home from create page");
}

- (void)unwindFromStack:(UIStoryboardSegue *)unwindSegue {
NSLog(@"Got home from stack page");
}

- (IBAction)goToCreate:(id)sender {
[self performSegueWithIdentifier:@"createModal" sender:self];
}

- (IBAction)goToStack:(id)sender {
[self performSegueWithIdentifier:@"stackModal" sender:self];
}


I gave the two segues identifiers like you can see in the action methods.


2 for the segues and 2 for unwinding. And of course the action methods connected to the buttons.


Is that a proper way to segue around?


thanks




Aucun commentaire:

Enregistrer un commentaire