zoukankan      html  css  js  c++  java
  • iOS UITabViewController use


    1 appdelegate.m

      #import "AppDelegate.h"


    #import "FirstViewController.h"


    #import "SecondViewController.h"

    #import "ThridViewController.h"

     

    {

        self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

        // Override point for customization after application launch.

        UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];

        UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];

        UIViewController *viewControll3 =[[[ThridViewController alloc] initWithNibName:@"ThridViewController" bundle:nil] autorelease];

        

        self.tabBarController = [[[UITabBarController alloc] init] autorelease];

        self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2,viewControll3, nil];

        self.window.rootViewController = self.tabBarController;

        [self.window makeKeyAndVisible];

        return YES;

    }

    2 FirstViewController.h

    @interface FirstViewController : UIViewController


    @end

    3 FirstViewController.m

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

    {

        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

        if (self) {

            self.title = NSLocalizedString(@"First", @"First");

            self.tabBarItem.image = [UIImage imageNamed:@"first"];

        }

        return self;

    }

  • 相关阅读:
    python(打印九九乘法表,三角形)
    Python (内置函数)
    python (生成器,生成推导式)
    python (函数名,闭包和迭代器)
    python (函数命名空间和作用域)
    python (函数)
    python (文件)
    python (集合和深浅拷贝)
    jquery 学习(四)
    JavaScript练习
  • 原文地址:https://www.cnblogs.com/csj007523/p/2642762.html
Copyright © 2011-2022 走看看