Tôi đã thêm thanh tab tùy chỉnh. Với các tab bao gồm nhiều tab hơn.Vấn đề định hướng giao diện thanh tab
Tab đầu tiên của tôi chỉ hỗ trợ chế độ dọc. Tab thứ hai có tất cả các định hướng.
Sự cố xảy ra khi chọn tab thứ hai và giữ nó ở chế độ ngang và sau đó chọn tab đầu tiên ở chế độ ngang. Vào thời điểm đó, chế độ xem tab đầu tiên được xoay sạch nhưng thanh tab vẫn ở chế độ ngang.
Làm cách nào để khắc phục tình huống này? Đây là nên xoay phương pháp trong điều khiển thanh tab tùy chỉnh
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (self.selectedIndex == 0) {
return [self.selectedViewController shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
} else if (self.selectedIndex == 1) {
return YES;
}
return NO;}
Đây là nên xoay phương pháp trong điều khiển xem đầu tiên và thứ hai hàng hải khiển
Đầu tiên
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);}
Second
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;}
Thanh tab vẫn còn trong phong cảnh là thanh tuỳ chỉnh? Bạn đã thêm vào màn hình như thế nào? –
@Terente Ionut Alexandru \t \t navigationController_ = [[UINavigationController alloc] initWithRootViewController: tabBarController_]; \t [self.window addSubview: navigationController_.view]; – xydev