提醒框在 iPad 中的适配

2017-02-08  本文已影响50人  丨不學無術丨

在将 iPhone 的 App 移植到 iPad 的时候,很容易会遇到,在弹出提醒框(UIAlertController)的时候奔溃;

主要针对 UIAlertController 的 Style 为 UIAlertControllerStyleActionSheet

这是因为在 iPad 中,UIAlertController没有容器需要手动添加,需要在每个UIAlertController创建以及弹出的前加入两行代码:

UIAlertController * alertC  = [UIAlertController alloc];

alertC.popoverPresentationController.sourceView = self.view;
alertC.popoverPresentationController.sourceRect = CGRectMake(0,0, 30, 30);
上一篇下一篇

猜你喜欢

热点阅读