Ios segues without navigation controllers

I would like to use storyboards to create my application. I can find a lot of information on how to use it with a navigation or tabcontroller, but I do not want this anyone.

My goal is to create an application with different views, but without using a navigation or tab. How to do it?

+5
source share
2 answers

In an iOS storyboard, if you do not want to use navigation, you cannot use push segue. Then you can use modal segue or custom segue. There are four transitions in the modal segment:

  • Cover Vertical
  • Flip horizontal
  • Cross dissolution
  • Partial curl

, segue segue. , . :

- (void) perform
{
UIViewController *desViewController = (UIViewController *)self.destinationViewController;

UIView *srcView = [(UIViewController *)self.sourceViewController view];
UIView *desView = [desViewController view];

desView.transform = srcView.transform;
desView.bounds = srcView.bounds;

if(isLandscapeOrientation)
{
    if(isDismiss)
    {
        desView.center = CGPointMake(srcView.center.x, srcView.center.y  - srcView.frame.size.height);
    }
    else
    {
        desView.center = CGPointMake(srcView.center.x, srcView.center.y  + srcView.frame.size.height);
    }
}
else
{
    if(isDismiss)
    {
        desView.center = CGPointMake(srcView.center.x - srcView.frame.size.width, srcView.center.y);
    }
    else
    {
        desView.center = CGPointMake(srcView.center.x + srcView.frame.size.width, srcView.center.y);
    }
}


UIWindow *mainWindow = [[UIApplication sharedApplication].windows objectAtIndex:0];
[mainWindow addSubview:desView];

// slide newView over oldView, then remove oldView
[UIView animateWithDuration:0.3
                 animations:^{
                     desView.center = CGPointMake(srcView.center.x, srcView.center.y);

                     if(isLandscapeOrientation)
                     {
                         if(isDismiss)
                         {
                             srcView.center = CGPointMake(srcView.center.x, srcView.center.y + srcView.frame.size.height);
                         }
                         else
                         {
                             srcView.center = CGPointMake(srcView.center.x, srcView.center.y - srcView.frame.size.height);
                         }
                     }
                     else
                     {
                         if(isDismiss)
                         {
                             srcView.center = CGPointMake(srcView.center.x + srcView.frame.size.width, srcView.center.y);
                         }
                         else
                         {
                             srcView.center = CGPointMake(srcView.center.x - srcView.frame.size.width, srcView.center.y);
                         }
                     }
                 }
                 completion:^(BOOL finished){
                     //[desView removeFromSuperview];
                     [self.sourceViewController presentModalViewController:desViewController animated:NO];
                 }];
}

, . YouTube, , :

Push Segue UINavigation

+6

? , .

, , , UIViewControllers, push-segue .

, , segue .

+2

All Articles