我想在我的項目中使用這個ECSlidingViewController。來自鏈接的示例應用程序使用故事板,但我想從xib加載全部。 我必須在應用程序中實現:didFinishLaunchingWithOptions:執行此操作嗎?從示例應用程序ECSlidingViewController從XIB加載
代碼:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
ECSlidingViewController *slidingViewController = (ECSlidingViewController *)self.window.rootViewController;
UIStoryboard *storyboard;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
}
slidingViewController.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"FirstTop"];
return YES;
}
如果你嘗試上面的代碼,你會得到「應用程序預計將有在應用程序啓動的最後一個根視圖控制器」在Xcode – fyasar 2012-05-15 21:08:00
我編輯我的回答錯誤不是故事板使用 – 2013-11-16 19:03:11