Target > General > Devices > iPad
- 不勾选
Require full screen
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
CGFloat newViewWidth = self.view.frame.size.width;
if (newViewWidth != _oldViewWidth) {
self.oldViewWidth = newViewWidth;
[self viewWidthUpdatedFromDidLayoutSubviews];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self viewWidthUpdated];
});
}
}
UIWindow 需要用keyWindow