我有一个应用程序,其代码如下:
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // UIWindow *window;
viewController = [TopicsViewController new]; //TopicsViewController *viewController; //This is a UITableViewController
navigationController = [UINavigationController new]; // UINavigationController *navigationController;
UIImageView *background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.png"]];
[self.navigationController.view addSubview:background];
[self.navigationController.view sendSubviewToBack:background];
[navigationController pushViewController:viewController animated:YES];
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
基本上我正在使用 UINavigationController,然后推送 UITableViewController 或有时是 UIViewController。UIViewController 包含 UITextView、UIImage、UIScrollView 等元素。问题是我一直在尝试让这个应用程序响应 iphone 旋转,例如,当处于横向时,应用程序应该切换到横向,反之亦然,但到目前为止没有任何效果。