美文网首页IOS开发iosiOS 开发
ios UIAlertController 使用ipad和iph

ios UIAlertController 使用ipad和iph

作者: iCloudEnd | 来源:发表于2015-07-06 16:11 被阅读6431次

    UIAlertController 在ipad中需要配置一下挂靠的控件,而在iphone却不需要的。

    下面代码可以适配

    UIAlertController *alert = [UIAlertController
                    alertControllerWithTitle:NSLocalizedString(@"分组管理",nil)
                    message:[NSString stringWithFormat:NSLocalizedString(@"分组:%@,  请选择您要进行的操作",nil),title]
                    preferredStyle:UIAlertControllerStyleActionSheet
                    ];



    if([EzSystemInfo isDevicePad])
        {
            UIPopoverPresentationController *popPresenter = [alert
                                                             popoverPresentationController];
            popPresenter.sourceView = cell;
            popPresenter.sourceRect = cell.bounds;
            [self presentViewController:alert animated:YES completion:nil];
        }
        else
            [self presentViewController:alert animated:YES completion:nil];       

    相关文章

      网友评论

      • 梁森的简书:我的项目中在模拟器的iPad上直接使用UIAlertController也没问题啊
      • 上善若水jf:请问可以设置UIAlertController尺寸大小吗,尤其在iPad 上面看起来相对比较小
      • aa3a820cc976:我这样写为什么在iPad下点击某个控件还是没反应
      • __Twotiger:哥,问一下我百度了好多资料一直不明白的是 里面的 “cell” 到底是指什么? self.view?
        __Twotiger:@CasouV 谢谢。明白了。
        CasouV:@_Twotiger cell就写你的控件就行.比如你是点击button弹出这个actionsheet的.

      本文标题:ios UIAlertController 使用ipad和iph

      本文链接:https://www.haomeiwen.com/subject/jbmyqttx.html