zoukankan      html  css  js  c++  java
  • UINavagationController页面跳转

    1.在AppDelegate中设置第一个加载的页面,根VIEW

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        FirstViewController *firstController = [[FirstViewController alloc] init];

        self.window.rootViewController = [[UINavigationController alloc]initWithRootViewController:firstController];

        self.window.backgroundColor = [UIColor whiteColor];

        [self.window makeKeyAndVisible];

        return YES;

    }

    2.页面跳转

        SecondViewController *secondController = [[SecondViewController alloc]init];

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

    3.页面返回

    -(void)backToFirstClick

    {

        UINavigationController *topNavagation  = self.navigationController.topViewController;

        if([topNavagation isKindOfClass:[SecondViewController class]])

        {

            UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"" message:@"确定要返回第一个页面吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];

            [alertView show];

        }

    }

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

    {

        if(buttonIndex == 1)

        {

            [self.navigationController popViewControllerAnimated:YES];

        }

    }

  • 相关阅读:
    SeaweedFS上手使用指南
    XyTalk企业即时通讯IM开始开源
    大数据项目相关技术栈(Hadoop周边技术)
    Hive SQL基础操作
    Applet Mode
    快速开始
    NetBeans启动Tomcat报“'127.0.0.1' 不是内部或外部命令”启动失败的解决办法
    运行带distance field的Hiero
    Game Loop的几种实现方式
    20150408
  • 原文地址:https://www.cnblogs.com/xiangjune/p/4955338.html
Copyright © 2011-2022 走看看