iPad actionsjeet
- 在iphone和ipad上使用UIActionShee控件t的效果会不一样,在苹果的官方文档中有相关说明:
在ipad上使用UIActionSheet控件改控件不再从底部弹出,而是从屏幕中间弹出与UIAlertView警告框弹出有点类似。效果如图所示,cancelButton按钮文字显示不出来,destructiveButtonTitle按钮文字为红色加粗字体。
- iOS 8.3以后不再使用actionsheet,而是统一用UIAlertController,所以如果有iOS7的用户,需要适配:
- //初始化actionsheet,适配 iOS 8.3 以下
- if([[UIDevice currentDevice].systemVersion floatValue] > 8.3){//iOS 8.3以上,废弃旧版actionsheet
- UIAlertController* actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
- UIAlertAction *sendAction = [UIAlertAction actionWithTitle:@"发送Log文件给微信好友" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
- [self SendLogToWechatFriends];
- }];
- [actionSheet addAction:sendAction];
- actionSheet.popoverPresentationController.sourceView = _logoImgView;
- actionSheet.popoverPresentationController.sourceRect = _logoImgView.bounds;
- [actionSheet.popoverPresentationController setPermittedArrowDirections:UIPopoverArrowDirectionUp];
- [self presentViewController:actionSheet animated:YES completion:nil];
- }else{//iOS 8.3以下使用旧版actionsheet
- UIActionSheet *actionSheet = [[UIActionSheet alloc]
- initWithTitle:nil
- delegate:self
- cancelButtonTitle:nil
- destructiveButtonTitle:nil
- otherButtonTitles:@"发送Log文件给微信好友",nil];
- actionSheet.actionSheetStyle = UIBarStyleDefault;
- actionSheet.delegate = self;
- [actionSheet showFromRect:[_logoImgView frame] inView:self.view animated:YES];
- }
- 为了避免适配,使用自定义的popovercontrolller,然后嵌入一个包着button的viewcontroller:
- UIViewController* actionSheet = [[UIViewController alloc]init];
- actionSheet.view.backgroundColor = [UIColor clearColor];
- // UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake((self.view.bounds.size.width-50)/4, 0, self.view.bounds.size.width-50, 50)];
- // label.text = @"发送Log文件给微信好友";
- // label.textColor = MttColorNamed(@"browser_startpage_news_category_color");
- // [actionSheet.view addSubview:label];
- UIButton* btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width-50, 50)];
- btn.backgroundColor =[UIColor clearColor];
- [btn setTitle:@"发送Log文件给微信好友" forState:UIControlStateNormal];
- btn.titleLabel.textAlignment = NSTextAlignmentCenter;
- [btn setTitleColor:MttColorNamed(@"browser_startpage_news_category_color") forState:UIControlStateNormal];
- [btn addTarget:self action:@selector(SendLogToWechatFriends) forControlEvents:UIControlEventTouchUpInside];
- [actionSheet.view addSubview:btn];
- MttPopoverController *popController = [[MttPopoverController alloc] initWithContentViewController:actionSheet];
- popController.popoverContentSize = CGSizeMake(self.view.bounds.size.width-50, 50);
- //popController.delegate = self;
- [popController presentPopoverFromRect:_logoImgView.frame inView:self.view permittedArrowDirections:WYPopoverArrowDirectionUp animated:YES];
- self.popoverController = popController;
- button在设置title颜色的时候,注意状态,“|”的意思是and,不是或
更多关于actionsheet,参考http://www.jianshu.com/p/4d1ca0d9a6f1
iPad actionsjeet的更多相关文章
- ipad&mobile通用webapp框架前哨战
响应式设计的意义 随着移动设备的发展,移动设备以迅猛的势头分刮着PC的占有率,ipad或者android pad的市场占有率稳步提升,所以我们的程序需要在ipad上很好的运行,对于公司来说有以下负担: ...
- ipad和iphone的适配
关于xib或者storybord下iphone的横竖屏的适配以及ipad的适配 ios8出现了Size Classes,解决了各种屏幕适配的问题,他把屏幕的宽和高分别分成了三种,把屏幕总共分成了九种情 ...
- Xcode will continue when iPad is finished. "Could not find Developer Disk Image"
1: Xcode will continue when iPad is finished. 等待进度条读取完成即可: 2: xcode,安装新版本的iOS 的 xcode 支持文件 的路径: /ap ...
- iPhone/iPad/Android UI尺寸规范 UI尺寸规范,UI图标尺寸,UI界面尺寸,iPhone6尺寸,iPhone6 Plus尺寸,安卓尺寸,iOS尺寸
iPhone/iPad/Android UI尺寸规范 UI尺寸规范,UI图标尺寸,UI界面尺寸,iPhone6尺寸,iPhone6 Plus尺寸,安卓尺寸,iOS尺寸 iPhone界面尺寸 设备 分辨 ...
- iPad编程
1. iPad 现有型号: iPad Pro, iPad Air, iPad mini 均配备Retina显示屏.早期还有iPad 依次对应的坐标系及分辨率: iPad Pro 坐标系:1366 x ...
- 在Mac电脑上为iPhone或iPad录屏的方法
在以前的Mac和iOS版本下,录制iPhone或者iPad屏幕操作是一件稍微复杂的事情.但是随着Yosemite的出现,在Mac电脑上为iPhone或iPad录屏的方法就变得简单了.下面就介绍一下具体 ...
- ipad
1. ipad pro 与 ipad air2 时间已经是2016.12.9, 苹果还没有推出新的ipad产品,有些纠结于哪款更适合自己,总结下产品不易获取的核心配置信息 ipad air2 ram ...
- 媒体查询判断ipad和iPhone各版本
/* 判断ipad */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px){ /* s ...
- iPad版微信终于来临了 微信5.4版搜索更智能 转账就是发消息
等待甚久的iPad版微信终于来临了!昨日微信iOS版本更新至5.4.0.16,新增功能包括搜索公众号.识别图中二维码.面对面收钱,同时适配iPad.(微信5.4安卓版重回ios风格 导航菜单都放底栏位 ...
随机推荐
- IP反查网站,ip反查接口,旁站查询接口大全,通过IP查域名汇总:
http://cn.bing.com/search?q=ip%3A220.181.111.85 http://dns.aizhan.com/?q=www.baidu.com http: ...
- 【X240 QQ视频对方听不到声音】解决方法
[X240 QQ视频对方听不到声音]解决方法: win7为例: 右键点击右下角的"小喇叭"图标,点击"录音设备",显演示样例如以下图: watermark/2/ ...
- 关于meta标签的name="viewport" 概述
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scal ...
- 转 FreeBSD通过PORTS安装软件的几个常用命令
1.怎样找到我想安装的包路径:# cd /usr/ports# make search name=mysql2.仅仅下载源码包,而不安装:# cd /usr/ports/directory# make ...
- BZOJ 1293 SCOI2009 生日礼物 堆
题目大意:给定一个数轴上n个点,每一个点有一种颜色,一共k种颜色.求一个最短的区间,包括全部k种颜色 卡了一段时间0.0 一開始想二分答案啥的 后来发现数据范围太大写不了0.0 后来去找题解才发现尼玛 ...
- hdu1081 最大子矩阵
最大子矩阵自然直在最大连续子序列的升级版 只是其原理都是用到了动态规划思想 仅仅是矩阵用到了枚举 +合并 把非常多列看成是一列的和 #include<stdio.h> ...
- snmp默认团体名/弱口令漏洞及安全加固
0x00基础知识 简单网络管理协议(SNMP)被广泛用于计算机操作系统设备.网络设备等领域监测连接到网络上的设备是否有任何引起管理上关注的情况.在运行SNMP服务的设备上,若管理员配置不当运行默认团体 ...
- Python,Pycharm,Anaconda等的关系与安装过程~为初学者跳过各种坑
1.致欢迎词 我将详讲讲述在学Python初期的各种手忙脚乱的问题的解决,通过这些步骤的操作,让你的注意力集中在Python的语法上以及后面利用Python所解决的项目问题上.而我自己作为小白,很不幸 ...
- ASP.NET机制详细的管道事件流程(转)
ASP.NET机制详细的管道事件流程 第一:浏览器向服务器发送请求. 1)浏览器向iis服务器发送请求网址的域名,根据http协议封装成请求报文,通过dns解析请求的ip地址,接着通过socket与i ...
- linux启动参数了解
文章来源:http://blog.csdn.net/uyiwfn/article/details/7172339在Linux中,给kernel传递参数以控制其行为总共有三种方法:1.build ker ...