这是我的应用程序委托的 applicationDidLaunch 方法:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self.window makeKeyAndVisible];
//This hides the status bar throughout the app.
[UIApplication sharedApplication].statusBarHidden=YES;
NSMutableArray *tabItems = [[NSMutableArray alloc] initWithCapacity:5];
GHHaikuViewController *hvc = [[GHHaikuViewController alloc] init];
hvc.tabBarItem.title = @"Home";
hvc.tabBarItem.image = [UIImage imageNamed:@"53-house.png"];
[tabItems addObject:hvc];
GHComposeViewController *cvc = [[GHComposeViewController alloc] init];
cvc.tabBarItem.title = @"Compose";
cvc.tabBarItem.image = [UIImage imageNamed:@"216-compose.png"];
[tabItems addObject:cvc];
GHWebViewController *wvc = [[GHWebViewController alloc] init];
wvc.tabBarItem.title = @"Buy";
wvc.tabBarItem.image = [UIImage imageNamed:@"80-shopping-cart.png"];
[tabItems addObject:wvc];
GHFeedback *fvc = [[GHFeedback alloc] init];
fvc.tabBarItem.title = @"Feedback";
fvc.tabBarItem.image = [UIImage imageNamed:@"18-envelope.png"];
[tabItems addObject:fvc];
GHSettingsViewController *svc = [[GHSettingsViewController alloc] init];
svc.tabBarItem.title = @"Settings";
svc.tabBarItem.image = [UIImage imageNamed:@"20-gear-2.png"];
[tabItems addObject:svc];
UITabBarController *tbc = [[UITabBarController alloc] init];
tbc.viewControllers = tabItems;
self.window.rootViewController = tbc;
return YES;
}
这是viewDidLoad
第一个视图控制器,为清楚起见进行了简化:
-(void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
background.backgroundColor = [UIColor whiteColor];
[self.view addSubview:background];
NSLog(@"View loaded.");
}
在 iPhone 上一切正常。在 iPad(或至少模拟器)上,“查看已加载”日志,但不是白屏,而是黑屏。早些时候我在玩 iPad 的故事板,但我已经删除了它,我认为我删除了所有文件,现在一切都从代码运行。我已经清理了项目。我在看什么?
编辑: 这是 Xcode 中目标摘要的截图。