• 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;

    }

  • 相关阅读:
    阿里巴巴面试题集合
    mysql的面试试题
    taobao面试要点
    properties文件value换行处理方式
    nginx添加需要代理的域名 配置
    spark基本概念
    MySQL半同步Semi-sync原理介绍【图说】
    J_D 仓储所用mysql版本
    mysql数据库的物理文件结构
    判断浏览器
  • 原文地址:https://www.cnblogs.com/csj007523/p/2642762.html
Copyright © 2020-2023  润新知