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

        }

    }

  • 相关阅读:
    编程总结3
    编程总结2
    编程总结1
    对我影响最深的老师
    自我介绍
    BFC 规则及解决的问题?
    简述 CSS 精灵图原理,及优缺点?
    等高布局、圣杯布局、双飞翼布局的实现原理
    CSS 基本选择器有哪些?
    CSS 引入方式有哪些?
  • 原文地址:https://www.cnblogs.com/xiangjune/p/4955338.html
Copyright © 2011-2022 走看看