1. iPAd 分屏

1.1. 如果支持分屏

  1. Target > General > Devices > iPad
  2. 不勾选 Require full screen

1.2. 如何监听屏幕变化

- (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];
        });
    }
}

1.3. 注意

UIWindow 需要用keyWindow

results matching ""

    No results matching ""