zoukankan      html  css  js  c++  java
  • ios 调节器 modal 得知

    代码中创建:

    1、appdelegate 该contoller放置controller下一个

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        
        self.window.rootViewController = [[MJOneViewController alloc] init];
        
        [self.window makeKeyAndVisible];
        return YES;
    }
    2、oneViewController跳转的action

    拿到要跳转的控制器的,然后通过当前的controller 来 调用 presentViewController

    - (IBAction)jump {
        // 展示MJTwoViewController
        MJTwoViewController *two = [[MJTwoViewController alloc] init];
        
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:two];
        
        [self presentViewController:nav animated:YES completion:^{
            NSLog(@"展示MJTwoViewController完成.......");
        }];
    }
    3、twoController 返回之前的controller

    调用 dismissViewController方法

    - (IBAction)cancel {
    //    NSLog(@"%@", self.view.window.rootViewController);
    //    NSLog(@"%@", self.view.window.subviews);
        [self dismissViewControllerAnimated:YES completion:^{
            NSLog(@"关闭MJTwoViewController....");
        }];
    //    [self.navigationController dismissViewControllerAnimated:YES completion:^{
    //        NSLog(@"关闭MJTwoViewController....");
    //    }];
    }


    在storyBoard创建modal控制器也非常方便。直接ctrl  右键点击 选举moadal状态




    版权声明:本文博主原创文章,博客,未经同意不得转载。

  • 相关阅读:
    libevent网络编程汇总
    LibEvent代码阅读--多缓冲区和零拷贝技术
    几个第三方库发图片
    Libevent使用例子,从简单到复杂
    CImage得到位图的大小
    从位图数据取得位图句柄
    BMP格式详解
    如何将内存中的位图数据绘制在DC上
    C++加载位图跟SOCKET通信的编写
    11235
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/4887119.html
Copyright © 2011-2022 走看看