使用AHKActionSheet
使用AHKActionSheet
https://github.com/fastred/AHKActionSheet
基本配置代码:
AHKActionSheet *actionSheet = [[AHKActionSheet alloc] initWithTitle:NSLocalizedString(@"您确定需要编辑?", nil)];
actionSheet.cancelButtonTitle = @"取消"; [actionSheet addButtonWithTitle:NSLocalizedString(@"信息", nil)
image:[UIImage imageNamed:@"Icon1"]
type:AHKActionSheetButtonTypeDefault
handler:^(AHKActionSheet *as) {
NSLog(@"Info tapped");
}]; [actionSheet addButtonWithTitle:NSLocalizedString(@"添加收藏", nil)
image:[UIImage imageNamed:@"Icon2"]
type:AHKActionSheetButtonTypeDefault
handler:^(AHKActionSheet *as) {
NSLog(@"Favorite tapped");
}]; [actionSheet addButtonWithTitle:NSLocalizedString(@"分享", nil)
image:[UIImage imageNamed:@"Icon3"]
type:AHKActionSheetButtonTypeDefault
handler:^(AHKActionSheet *as) {
NSLog(@"Share tapped");
}]; [actionSheet addButtonWithTitle:NSLocalizedString(@"删除", nil)
image:[UIImage imageNamed:@"Icon4"]
type:AHKActionSheetButtonTypeDestructive
handler:^(AHKActionSheet *as) {
NSLog(@"Delete tapped");
}]; [actionSheet show];
高级配置代码:
- (IBAction)advancedExampleTapped:(id)sender
{
AHKActionSheet *actionSheet = [[AHKActionSheet alloc] initWithTitle:nil]; actionSheet.blurTintColor = [UIColor colorWithWhite:0.0f alpha:0.75f];
actionSheet.blurRadius = 8.0f;
actionSheet.buttonHeight = 50.0f;
actionSheet.cancelButtonHeight = 50.0f;
actionSheet.animationDuration = 0.5f;
actionSheet.cancelButtonShadowColor = [UIColor colorWithWhite:0.0f alpha:0.1f];
actionSheet.separatorColor = [UIColor colorWithWhite:1.0f alpha:0.3f];
actionSheet.selectedBackgroundColor = [UIColor colorWithWhite:0.0f alpha:0.5f];
UIFont *defaultFont = [UIFont fontWithName:@"Avenir" size:17.0f];
actionSheet.buttonTextAttributes = @{ NSFontAttributeName : defaultFont,
NSForegroundColorAttributeName : [UIColor whiteColor] };
actionSheet.destructiveButtonTextAttributes = @{ NSFontAttributeName : defaultFont,
NSForegroundColorAttributeName : [UIColor redColor] };
actionSheet.cancelButtonTextAttributes = @{ NSFontAttributeName : defaultFont,
NSForegroundColorAttributeName : [UIColor whiteColor] };
actionSheet.cancelButtonTitle = @"取消"; UIView *headerView = [[self class] fancyHeaderView];
actionSheet.headerView = headerView; [actionSheet addButtonWithTitle:NSLocalizedString(@"信息", nil)
image:[UIImage imageNamed:@"Icon1"]
type:AHKActionSheetButtonTypeDefault
handler:nil]; [actionSheet addButtonWithTitle:NSLocalizedString(@"添加收藏", nil)
image:[UIImage imageNamed:@"Icon2"]
type:AHKActionSheetButtonTypeDefault
handler:nil]; for (int i = ; i < ; i++) {
[actionSheet addButtonWithTitle:[NSString stringWithFormat:@"分享 %d", i]
image:[UIImage imageNamed:@"Icon3"]
type:AHKActionSheetButtonTypeDefault
handler:nil];
} [actionSheet addButtonWithTitle:NSLocalizedString(@"删除", nil)
image:[UIImage imageNamed:@"Icon4"]
type:AHKActionSheetButtonTypeDestructive
handler:nil]; [actionSheet show];
} #pragma mark - Private + (UIView *)fancyHeaderView
{
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Cover"]];
imageView.frame = CGRectMake(, , , );
[headerView addSubview:imageView];
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(, , , )];
label1.text = @"你提供的一些有用信息";
label1.textColor = [UIColor whiteColor];
label1.font = [UIFont fontWithName:@"Avenir" size:17.0f];
[headerView addSubview:label1]; return headerView;
}
模糊背景怎么实现的呢?
先截图:
再模糊:
惯用伎俩哦:)
使用AHKActionSheet的更多相关文章
- github上所有大于800 star OC框架
https://github.com/XCGit/awesome-objc-frameworks#awesome-objc-frameworks awesome-objc-frameworks ID ...
随机推荐
- java aop做一个接口耗时的计算
看代码: @Aspect @Component public class TimeCostAspect { private static Logger logger = LoggerFactory.g ...
- 16-hadoop-mapreduce简介
mapreduce是hadoop的核心组件, 设计理念是移动计算而不是移动数据, mapreduce的思想是'分而治之', 将复杂的任务分解成几个简单的任务去执行 1, 数据和计算规模大大减少 2, ...
- 外网访问不了Xampp(本地访问不了虚拟机的Xampp)
安装好了Xampp,在虚拟机是可以访问的, 浏览器中输入localhost 嘛 不过在本地就是访问不了,ping是能通过的 然后网上查了一些资料,并结合Xampp的提示: 特别注意:如果连上面这 ...
- jqGrid随窗口大小变化自适应大小-转
第一种: jqGrid随窗口大小变化自适应宽度 $(function(){ $(window).resize(function(){ $("#listId").setGridWid ...
- lucene源码分析(8)MergeScheduler
1.使用IndexWriter.java mergeScheduler.merge(this, MergeTrigger.EXPLICIT, newMergesFound); 2.定义MergeSch ...
- SSL编程(1) 概述
文章来自本园马若望 SSL是TCP/IP环境上的标准的安全加密传输协议.SSL的全称是安全的 Socket层,它具有与Socket类似的客户端/服务器体制.常见的https即http+ssl,从安全的 ...
- 【LeetCode题解】160_相交链表
目录 160_相交链表 描述 解法一:哈希表 思路 Java 实现 Python 实现 解法二:双指针(推荐) 思路 Java 实现 Python 实现 160_相交链表 描述 编写一个程序,找到两个 ...
- HTML5的拖放事件
1.给标签添加属性draggable=ture即可允许拖放,有些标签可以不加,例如img有图片.a有url,默认拥有拖放功能 2.事件在被拖动元素上触发 ondragstart ondrag ondr ...
- HTML5的audio在手机网页上无法自动加载/播放音乐,能否实现该功能?
在IOS中第一次调用play方法播放音频会被阻止,必须得等用户有交互动作,比如touchstart,click后才能正常调用,在微信中可以通过监听WeixinJSBridgeReady事件来提前播放一 ...
- 三:Jquery-event
一:jq中事件 1.页面载入事件 ready()方法 格式: $(document).ready(function(){}); $(function(){}); 2.绑定事件 click(),dblc ...