IOS 6.0
XCODE 4.6.2
本人也是xib的初学者,按以下连接在ipad上做了一个练习,运行正常。
http://blog.youkuaiyun.com/totogo2010/article/details/7615495
但是当我想设置为横屏时,做了如下设置:
1. Supported Interface Orientations
选择了Landscape Left 和 Landscape Right
2. root controller xib 文件设置:
Simulated Metrics - Orientation: Landscape.
3. AppDelegate 添加代码
AppDelegate.h: append IBOutlet
AppDelegate.m:
失败1:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{...
[[NSBundle mainBundle] loadNibNamed:@"GUNRootViewController" owner:self options:nil];
[self.window addSubview:self.rootViewController.view];
self.rootViewController = [[ViewController alloc] initWithNibName:@"GUNRootViewController" bundle:nil];
self.window.rootViewController = self.rootViewController;
[[NSBundle mainBundle] loadNibNamed:@"GUNRootViewController" owner:self options:nil];
self.window.rootViewController = self->rootViewController;