zoukankan      html  css  js  c++  java
  • tabbar 嵌套 navigation






    --------------

    源代码点击打开链接

    ------------------------

     AppDelegate.m


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

    {

        self.window = [[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];

        // Override point for customization after application launch.

        

        

        

        if ([[UIDevicecurrentDevice]userInterfaceIdiom] ==UIUserInterfaceIdiomPhone) {

           UIViewController *oneVC = [[OneViewControlleralloc]initWithNibName:@"one_iphone"bundle:nil];

            UINavigationController *Nav1 = [[UINavigationControlleralloc]initWithRootViewController:oneVC];

            

           UIViewController *twoVC = [[TwoViewControlleralloc]initWithNibName:@"two_iphone"bundle:nil];

            UINavigationController *Nav2 = [[UINavigationControlleralloc]initWithRootViewController:twoVC];

            

           UIViewController *threeVC = [[ThreeViewControlleralloc]initWithNibName:@"three_iphone"bundle:nil];

            UINavigationController *Nav3 = [[UINavigationControlleralloc]initWithRootViewController:threeVC];

            

           UIViewController *fourVC = [[FourViewControlleralloc]initWithNibName:@"four_iphone"bundle:nil];

            UINavigationController *Nav4 = [[UINavigationControlleralloc]initWithRootViewController:fourVC];

           self.tabbarController = [[UITabBarControlleralloc]init];

           self.tabbarController.viewControllers =@[Nav1,Nav2,Nav3,Nav4];

            

        }else {

           UIViewController *oneVC = [[OneViewControlleralloc]initWithNibName:@"one_ipad"bundle:nil];

            UINavigationController *oneNav = [[UINavigationControlleralloc]initWithRootViewController:oneVC];

            

           UIViewController *twoVC = [[TwoViewControlleralloc]initWithNibName:@"two_ipad"bundle:nil];

            UINavigationController *twoNav = [[UINavigationControlleralloc]initWithRootViewController:twoVC];

            

           UIViewController *threeVC = [[ThreeViewControlleralloc]initWithNibName:@"three_ipad"bundle:nil];

            UINavigationController *threeNav = [[UINavigationControlleralloc]initWithRootViewController:threeVC];

            

           UIViewController *fourVC = [[FourViewControlleralloc]initWithNibName:@"four_ipad"bundle:nil];

            UINavigationController *fourNav = [[UINavigationControlleralloc]initWithRootViewController:fourVC];

            

           self.tabbarController = [[UITabBarControlleralloc]init];

           self.tabbarController.viewControllers =@[oneNav,twoNav,threeNav,fourNav];

        }


        

      

        self.window.rootViewController =self.tabbarController;

        

        

            

        self.window.backgroundColor = [UIColorwhiteColor];

        [self.windowmakeKeyAndVisible];

        return YES;

    }


    -------------------------

    OneViewController.m

    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

    {

       self = [superinitWithNibName:nibNameOrNilbundle:nibBundleOrNil];

       if (self) {

            // Custom initialization

            

           self.title =@"one";

            self.tabBarItem.image = [UIImageimageNamed:@"second.png"];

            

            //navigationbar 右边的按钮

           UIBarButtonItem *rightButton = [[UIBarButtonItemalloc]initWithTitle:@"下一层" style:UIBarButtonItemStyleBordered target:self action:@selector(rightTap:)];

            self.navigationItem.rightBarButtonItem = rightButton;

            

             //navigationbar 左边的按钮

            UIBarButtonItem *leftButton = [[UIBarButtonItemalloc]initWithTitle:@"更多"style:UIBarButtonItemStyleBorderedtarget:selfaction:@selector(leftTap:)];

            self.navigationItem.leftBarButtonItem = leftButton;

            

        }

        return self;

    }


    ----------------------------


    navigation 从第一层跳到第二层里面。。

    - (IBAction)rightTap:(id)sender {

        

        

        oneAViewController *VC = [[oneAViewControlleralloc]initWithNibName:@"oneA_iphone"bundle:nil];

        VC.title =@"第二层";

        [self.navigationControllerpushViewController:VCanimated:YES];

        



    }




    ----------

    显示98%。。。显示百分号%

     valueLabel.text = [NSString stringWithFormat:@"%.0f%%",progressValue];    


    ---------------------------




  • 相关阅读:
    [题解](组合数/二位前缀和)luogu_P2822组合数问题
    [题解](tarjan割点/点双)luogu_P3225_矿场搭建
    [题解](树形dp/换根)小x游世界树
    [題解](DP)CF713C_Sonya and Problem Wihtout a Legend
    [題解]hdu_6412公共子序列
    [題解](最小生成樹)luogu_P2916安慰奶牛
    [题解](堆)luogu_P1631序列合并
    [题解](最短路)luogu_P5122 Fine Dining
    [题解](次短路)luogu_P2865路障(未)
    [题解](最短路(树))luogu_P5201_short cut
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3343313.html
Copyright © 2011-2022 走看看