ActionSheet在iPad上的适配兼容

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ws_752958369/article/details/85046456

兼容适配比较简单,只需要在prenset之前加一个系统校验:

if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad) {
        if (alertController.popoverPresentationController != nil) {
            alertController.popoverPresentationController.sourceView = self.view;
            alertController.popoverPresentationController.sourceRect = CGRectMake(touchPoint.x, touchPoint.y, 1.0, 1.0);
        }
    }
    
    [self presentViewController:alertController animated:YES completion:nil];

猜你喜欢

转载自blog.csdn.net/ws_752958369/article/details/85046456