Can I switch to another view without a StoryBoard segue? Just challenging in terms?

SO I would like to know if it is possible to make a call from a view in code to go to another view without using segue.

Thanks for the help.

+5
source share
2 answers

Yes, if you are using a navigation controller, you just need to click on the navigation controller:

[self.navigationController pushViewController:otherViewCon animated:YES];

Or if you want a modal transition:

[self presentModalViewController:otherViewCon animated:YES];

This is all assumed to be selfa UIViewController.

To get otherViewConusing the developed storyboard view controller:

otherViewCon = [self.storyboard instantiateViewControllerWithIdentifier:@"Other View"];
+7
source

Popover view example:

    //Declare popover controller
    UIPopoverController *paparazzi;

   //Just some Interface Builder action (could be triggered by a button)
    - (IBAction)sigFocus:(id)sender
    {
        //A view controller being made from a xib file
        SigPopView *temp = [[SigPopView alloc] initWithNibName:@"SigPopView" bundle:nil];

        //Sets the view controller to be displayed
        paparazzi = [[UIPopoverController alloc] initWithContentViewController:temp];

        //Set size
        [paparazzi setPopoverContentSize:CGSizeMake(480,179)];

        //Show controller
        [paparazzi presentPopoverFromRect:theSignature.frame inView:(UIView *)self.delegate permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }
0
source

All Articles