• 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,如果其他页面需要,可以类似这样创建。

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

  • 相关阅读:
    ajax 拼接html标签 thinkphp
    使用Log4J进行日志操作
    学习Spark2.0中的Structured Streaming(一)
    互联网日志实时收集和实时计算的简单方案
    Integer.valueOf方法的源码解读
    spark的ML和MLLib两个包区别和联系?
    数组和集合区别
    Java中的集合类
    Spark会把数据都载入到内存么?
    可变参数
  • 原文地址:https://www.cnblogs.com/maxfong/p/2481472.html
Copyright © 2020-2023  润新知