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];

        }

    }

  • 相关阅读:
    无刷电机控制基本原理
    SPI 串行Flash闪存W25Q128FV 的使用(STM32F407)_软件篇
    CAN总线简介
    RS-232串口特性
    PLSQL 安装教程
    JS 常用正则表达式备忘录
    JS数组去重
    Js中Map对象的使用
    JS操作字符串
    前端小技巧
  • 原文地址:https://www.cnblogs.com/xiangjune/p/4955338.html
Copyright © 2011-2022 走看看