Tôi có một số UINavigationController
với gốc UIViewController
("root").iOS8 - Sau khi đẩy UIViewController trên UINavigationController và xoay thiết bị, kích thước không đúng trong bộ điều khiển xem trước
Trình điều khiển chế độ xem gốc đẩy khác UIViewController
"con". Khi "con" UIViewController
nằm trên màn hình, tôi xoay thiết bị và mong muốn bộ điều khiển chế độ xem "gốc" thay đổi kích thước cho phù hợp nhưng điều này không xảy ra. Sau khi đặt điểm ngắt trong bộ điều khiển chế độ xem gốc:
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}
Tôi thấy kích thước sai và trình điều khiển chế độ xem gốc không điều chỉnh đúng cho thay đổi.
Có ai trải qua hành vi này không?
Mã này là như vậy:
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
/// The size is wrong if this view controller is off screen
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Dưới đây là một màn hình in của NSLog kích thước sau khi xoay thiết bị - Đây là từ mô phỏng nhưng hành vi này là như nhau trên thiết bị.
Nhật ký kích thước của bạn là gì, bạn mong đợi điều gì? – gabbler
Tôi sẽ thêm một màn hình in - sau khi tôi đã xoay thiết bị vài lần. Lưu ý rằng kích thước luôn giống nhau. –
Có, nó luôn luôn có cùng kích thước, có vẻ như bộ điều khiển Gốc Xem không xoay chút nào. – gabbler