1
我有一個UISplitViewController安裝程序,但由於某種原因,背景沒有持續下去,直到你旋轉了一次。iPad - UISplitViewController - 背景顏色
我使用IB來設置拆分視圖並將詳細視圖設置爲IPadDetailViewController
。裏面,我有以下幾點:
- (void)loadView {
[super loadView];
self.view.backgroundColor = [UIColor greenColor];
toolbar = [[UIToolbar alloc] initWithFrame:CGRectZero];
toolbar.barStyle = UIBarStyleDefault;
[toolbar sizeToFit];
[self.view addSubview:toolbar];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
self.view.backgroundColor = [UIColor orangeColor];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
self.interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
NSLog(@"it is in landscape!");
self.view.backgroundColor = [UIColor grayColor]];
}
else {
NSLog(@"it is in portrait!");
self.view.backgroundColor = [UIColor blueColor];
}
}
雖然代碼被運行,我的工具欄在頂部得到的地方,視圖保持黑色(它開始在景觀的模擬器)。
任何想法,爲什麼?
好主意,但沒有奏效。 :/ – RyanJM 2011-01-28 05:18:40