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

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

  • 相关阅读:
    [抄书]The Pipes and Filters pattern
    [抄书]The Layers pattern
    OpenGL Step by Step (1)
    [HOOPS]二维点向三维空间投影
    心仪已久的工具:BoundsChecker v7.2
    [HOOPS]用HC_Show_...获取正确的点的坐标位置
    小试zlib
    XML (2) Document Type Definitions (DTD)
    UML (1) 设计模式及作业附图
    XML (1) 什么是XML
  • 原文地址:https://www.cnblogs.com/maxfong/p/2481472.html
Copyright © 2011-2022 走看看