【发布时间】:2013-12-25 21:00:52
【问题描述】:
根据我在互联网上阅读的内容,笔尖和故事板在同一个项目中可以相互比较。现在我正在创建一个选项卡式应用程序,并希望执行以下操作:
Tab 1:用笔尖构造,
标签 2:用故事板构建,
标签 3:用笔尖构造
最初我使用 nibs 创建了所有内容,因此在我的委托中,我使用以下代码从一个选项卡传递到下一个选项卡:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
UIViewController *viewController1, *viewController2, *viewController3;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController_iPhone" bundle:nil] autorelease];
viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController_iPhone" bundle:nil] autorelease];
viewController3 = [[[ThirdViewController alloc] initWithNibName:@"ThirdViewController_iPhone" bundle:nil] autorelease];
} else {
viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController_iPad" bundle:nil] autorelease];
viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController_iPad" bundle:nil] autorelease];
viewController3 = [[[ThirdViewController alloc] initWithNibName:@"ThirdViewController_iPad" bundle:nil] autorelease];
}
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = @[viewController1, viewController2, viewController3];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
我需要 SecondViewController_.storyboard,而不是 SecondViewController_.xib。我该怎么做呢?我可以将名称“SecondViewController_.nib”更改为“SecondViewController_.storyboard”吗?我不认为这会起作用..
任何帮助将不胜感激!
编辑: 我使用的代码:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Events", @"Events");
self.tabBarItem.image = [UIImage imageNamed:@"second"];
}
return self; }
【问题讨论】:
标签: ios storyboard uitabbarcontroller xib nib