新建Tabbed application,名为Tabview
新建一个viewController
修改AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]]autorelease];
// Override point for customization after application launch.
UIViewController *viewController1 = [[[FirstViewControlleralloc] initWithNibName:@"FirstViewController"bundle:nil]autorelease];
UIViewController *viewController2 = [[[SecondViewControlleralloc] initWithNibName:@"SecondViewController"bundle:nil]autorelease];
ThirdViewController *vc3 =[[[ThirdViewControlleralloc] init] autorelease];
self.tabBarController = [[[UITabBarControlleralloc] init]autorelease];
self.tabBarController.viewControllers =@[viewController1, viewController2,vc3];
self.window.rootViewController =self.tabBarController;
[self.windowmakeKeyAndVisible];
return YES;
}
修改ThirdViewController.m- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
self.title =@"第三个";
self.tabBarItem.image = [UIImageimageNamed:@"second"];
}
return self;
}
源码地址:http://download.youkuaiyun.com/detail/cloud95/5187356
iOS Tabbed App 创建教程
本文详细介绍如何在iOS中创建带有三个视图控制器的Tabbed应用程序。从新建项目开始,逐步介绍如何设置和配置UITabBarController,以及如何为每个Tab自定义ViewController。
842

被折叠的 条评论
为什么被折叠?



