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;

    }

  • 相关阅读:
    第0次作业
    第4次作业
    第3次作业
    第2次作业
    C#浮点数保留位数
    第0次作业
    软件工程第4次作业
    软件工程第3次作业
    软件工程第2次作业
    软件工程第1次作业
  • 原文地址:https://www.cnblogs.com/csj007523/p/2642762.html
Copyright © 2011-2022 走看看