更新 1
更新 1
更新 0
.
更新 0
这个很好的问题和答案并不完全适用于我的通用应用程序,它同时具有 iPhone 和 iPad xibs,现在想要使用情节提要。
这是基于 xib 的 BSAppDelegate.m(在故事板之前)
#import "BSAppDelegate.h"
#import "BSViewController.h"
@implementation BSAppDelegate
NSString *receivedData;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// return YES;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[BSViewController alloc] initWithNibName:@"BSViewController_iPhone" bundle:nil];
} else {
self.viewController = [[BSViewController alloc] initWithNibName:@"BSViewController_iPad" bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
我试图在else
上面的代码之后插入以下代码,但我无法完全完成需要设置self.viewController
为与上述代码兼容的代码修复。
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"BSViewController"];
vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:vc animated:YES completion:NULL];
你能告诉我如何修复我的代码吗?我正在使用 Xcode 4.5.2 并为 iOS 6 开发。