UIAlertController *alert = [UIAlertController

alertControllerWithTitle:@"上传文件"

message:@"请选择"

preferredStyle:UIAlertControllerStyleActionSheet];之后插入下面这段代码,就可以完成适配。

UIPopoverPresentationController *popover =

        alert.popoverPresentationController;

    // UIButton *button = (UIButton *)sender;

    if (popover) {

      popover.sourceRect =

          CGRectMake(self.view.center.x, self.view.frame.size.height, , );

      popover.sourceView = self.view;

      popover.permittedArrowDirections = UIPopoverArrowDirectionDown;

    }

最后,推出

[self presentViewController:alert animated:YES completion:nil];

成功。

适配iPad的操作表sheet的更多相关文章

  1. presentViewController底部弹框适配ipad

    //适配ipad if ([alert respondsToSelector:@selector(popoverPresentationController)]) { alert.popoverPre ...

  2. SpriteKit游戏开发适配iPad/iPhone6/7/8/Plus及iPhoneX的尺寸及安全区域

    未适配前:Ball球超过屏幕的上下方   适配后:Ball球就在屏幕的可视范围内运动了 一.那么如何适配不同的iPhone.iPhoneX及iPad的屏幕尺寸呢? 我们开发一个App的时候, 通常希望 ...

  3. 48 (OC)* 适配iPad和iPhone、以及横竖屏适配。

    一:核心方法 1.三个方法 1.1:开始就会触发 - (void)viewWillLayoutSubviews; 1.2:开始就会触发 - (void)viewDidLayoutSubviews; 1 ...

  4. iphone程序适配ipad可以用下面的宏进行尺寸改写

    //判断是否为iPad #define ISIPAD [[[UIDevice currentDevice].model substringToIndex:4] isEqualToString:@&qu ...

  5. 适配ipad Pro

    买了个新款ipad pro 11寸的,发现我们的ipad项目. 上下左右都有黑边 使用info.plist设置启动图,不用asset和launch storyboard 图片用如下格式命名,拖到项目中 ...

  6. OC和Swift中的UITabBar和UINaviGationBar的适配 [UITabbar在IPad中的适配]

    作者 sundays http://www.cnblogs.com/sundaysgarden/ OC中UITabbar的适配[iphoneX和Ipad适配] 自定可以UITabar 自定义UITab ...

  7. iPad版微信终于来临了 微信5.4版搜索更智能 转账就是发消息

    等待甚久的iPad版微信终于来临了!昨日微信iOS版本更新至5.4.0.16,新增功能包括搜索公众号.识别图中二维码.面对面收钱,同时适配iPad.(微信5.4安卓版重回ios风格 导航菜单都放底栏位 ...

  8. iOS Storyboard适配问题

      通用的Storyboard 通用的stroyboard文件是通向自适应布局光明大道的第一步.在一个storyboard文件中适配iPad和iPhone的布局在iOS8中已不再是梦想.我们不必再为不 ...

  9. iPad Pro 10.5+Apple Pencil之专注文献阅读与笔记效率的App综述

    先谈谈我对笔记类App的几点要求--原则是取其精华,略其糟粕,毕竟开发者们还在,App就会不断地被改进: 增删快捷方便:如完美支持Apple Pencil,特定场景下强大的录音功能,单词或短句涂改即可 ...

随机推荐

  1. Linq to sql 操作

    1.往数据库添加数据 NorthwindDataContext abc = new NorthwindDataContext(); abc.Log = Console.Out; User a = ne ...

  2. 关于“创业者与VC见面的10个不成文细节点”

    著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处.作者:Will Wang链接:http://www.zhihu.com/question/19641135/answer/50974 ...

  3. HttpContext.Cache和Application的区别

    原文:HttpContext.Cache和Application的区别 (转载)   应用程序级的Cache和Application用户会话级的Session application的缺点是在读取时最 ...

  4. docker网络-如何让外部网络访问容器资源

    docker网络-如何让外部网络访问容器资源 安装httpd 服务: docker:/root# docker exec -it f63b2633d146 bash bash-4.1# yum ins ...

  5. Unity3d 打包时报错 CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.

    今天打包带有Android插件的unity3d 项目是,报错CommandInvokationFailure: Unable to convert classes into dex format. S ...

  6. html和js

    1.<input type="button" value="Hello world!"> 2.<button type="butto ...

  7. KMP模式匹配 三(弦)

    原文请訪问我的博客:xiaoshig.sinaapp.com KMP模式匹配 三(串) Time Limit:1000MS     Memory Limit:131072KB     64bit IO ...

  8. DevExpress学习1

    为了程序的美观设计,决定用dev控件. 第一步,去官网下载了试用30天的安装包,官网地址:https://www.devexpress.com/,安装完成. 第二步,开始程序下找到DevExpress ...

  9. Can't load IA 32-bit .dll on a AMD 64-bit platform

    在myeclipse中使用的,tomcat异常:java.lang.UnsatisfiedLinkError: D:\JAVA\ApacheTomcat\bin\tcnative-1.dll: Can ...

  10. U3D学习使用笔记(三)

    1.对动画进行播放和暂停(从初始位置) (1).老版动画系统Animation 暂停 an["Take 001"].time = 0f; an["Take 001&quo ...