zoukankan      html  css  js  c++  java
  • FirstApp,iphone开发学习总结0,创建TabBar

    在FirstAppAppDelegate.m的添加文件引用

    #import "ImageViewController.h"
    #import "TableViewController.h"
    #import "ButtonViewController.h"
    #import "TextFieldViewController.h"
    #import "NavViewController.h"

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

    中添加TabBarController以及NavigationController。
        UITabBarController *tabController = [[UITabBarController alloc] init];

        ImageViewController *imgTab = [[ImageViewController alloc] init];
        TableViewController *tableTab = [[TableViewController alloc] init];
        ButtonViewController *btnTab = [[ButtonViewController alloc] init];
        TextFieldViewController *textTab = [[TextFieldViewController alloc] init];
        
        NavViewController *navTab = [[NavViewController alloc] init];
        UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:navTab];
        
        NSArray *tabArray = [[NSArray alloc] initWithObjects:imgTab, tableTab, btnTab, textTab, navigation, nil];
        
        [navigation release];
        [imgTab release];
        [tableTab release];
        [btnTab release];
        [textTab release];
        [navTab release];
        
        [tabController setViewControllers:tabArray];
        [tabArray release];
        
        [self.window setRootViewController:tabController];
        [tabController release];

    所表达的是:第5个(NavView页面)创建了NavigationConroller,如果其他页面需要,可以类似这样创建。

    没有经验的伤不起啊,求指点更好的方法。

  • 相关阅读:
    路径问题
    移动端推荐使用
    js获取各种宽高方法
    html 符号大全
    bzoj4923 K小值查询
    bzoj3781 小B的询问
    bzoj1799 [Ahoi2009]self 同类分布
    bzoj2005 [Noi2010]能量采集
    bzoj4039 集会
    bzoj2516 电梯
  • 原文地址:https://www.cnblogs.com/maxfong/p/2481472.html
Copyright © 2011-2022 走看看