Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The easiest solution is to create manual segue in story board and use that as seen below.</p> <pre><code>[self performSegueWithIdentifier:@"loginSuccessSegue" sender:self]; </code></pre> <hr> <p>Or </p> <hr> <p>@Fabio: I was trying to get a solution for same kind of use-cases and I almost found a solution.</p> <p>Use-cases 1. Stop segue transition conditionally 2. Change destination viewController conditionally</p> <p>Solution:</p> <p>Use "Custom" segue. Follow below steps to create Custom segue 1. Create a subclass of UIStoryboardSegue "MyCustomSegue.h"</p> <pre><code>@interface MyCustomSegue : UIStoryboardSegue @end </code></pre> <p>"MyCustomSegue.m"</p> <p>Override initWithIdentifier for implementing use-case 1 and 2 If you return nil, segue will be cancelled/no action will be taken You instantiate your ViewController and set that as a destination. You can set destination as your old xib file also.. that code is commented, but I ensured that will work.</p> <pre><code>@implementation MyCustomSegue - (id)initWithIdentifier:(NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination{ UIStoryboard *storyBoard= [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil]; UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:@"testIdentifier"]; // MyViewController* viewController= [[MyViewController alloc]initWithNibName:@"MyViewController" bundle:nil]; return [super initWithIdentifier:identifier source:source destination:viewController]; } </code></pre> <ol start="2"> <li>You must override "perform". </li> </ol> <p>You can implement use-case 1 here also..</p> <pre><code>- (void)perform { // if either source or destination is nil, stop if (nil == self.sourceViewController || nil == self.destinationViewController) return; // return; //No Action. Segue will be cancelled UINavigationController *ctrl = [self.sourceViewController navigationController]; [ctrl pushViewController:self.destinationViewController animated:YES]; } </code></pre> <p>Hope this helps. Plz write if you are not clear.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload