使用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 ...
随机推荐
- redis 安装 与错误解决办法
redis 安装与安装中遇到的错误 redis 安装 wget http://download.redis.io/releases/redis-4.0.11.tar.gz .tar.gz cd red ...
- 笔记二:python编码详解
一:学习内容 python编码讲解 python编码说明 python中文乱码解决三部曲 二:python编码讲解 1. ASCII编码 美国信息交换标准代码(American Standard Co ...
- HTML5的拖放事件
1.给标签添加属性draggable=ture即可允许拖放,有些标签可以不加,例如img有图片.a有url,默认拥有拖放功能 2.事件在被拖动元素上触发 ondragstart ondrag ondr ...
- javaScript中用eval()方法转换json对象
var u = eval('('+user+')'); 1.对于服务器返回的JSON字符串,如果jQuery异步请求没做类型说明,或者以字符串方式接受,那么需要做一次对象化处理,方式不是太麻烦,就是将 ...
- bind9配置转发服务
修改bind主配置文件 $ vi /etc/named.conf//// named.conf//// Provided by Red Hat bind package to configure th ...
- 用Shell编写项目发布脚本
1.首先在github上创建一个测试用的仓库 2.本地编写一个可以运行的测试项目,上传至github 3.链接服务器,编写脚本如下:注意:编写前需要在服务器上安装git和maven 执行build_c ...
- s11d27 算法
s11d27 算法 一.理论 1.1 时间复杂度和空间复杂度的理论: 1)空间复杂度: 是程序运行所以需要的额外消耗存储空间,一般的递归算法就要有o(n)的空间复杂度了, 简单说就是递归集算时通常是反 ...
- Html5音频播放
Audio标签: 不需要下载任何的额外的浏览器插件 完全由浏览器自身实现音频的解码和播放 用法: <audio src="1.mp3" controls></au ...
- ORACLE数据库数据的备份与恢复
原创作品,转自请在文字开头显眼位置注明出处:https://www.cnblogs.com/sunshine5683/p/10052949.html 数据备份恢复在数据库管理中至关重要,今天,总结一下 ...
- HDU 4135 Co-prime 欧拉+容斥定理
Co-prime Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su ...