我正在开发一个仅支持在我的 Info.plist 文件中写入的纵向的应用程序。但是当我旋转设备时,状态栏会旋转,但视图不会。我不使用 InterfaceBuilder 来设置我的视图和初始窗口,我以编程方式编写:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = myRootViewController;
[self.window makeKeyAndVisible];
return YES;
}
在我所有的观点中,有一个方法:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
我该如何解决这个问题?