使用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 ...
随机推荐
- PyCharm2018专业版激活步骤
激活步骤: 1.更改hosts文件,2 获取注册码, 3 完成注册. 1. 更改host文件 hosts文件的路径 : c:\windows\system32\drivers\etc\hosts 将 ...
- 正确的C++/C堆栈
在理解C/C++内存分区时,常会碰到如下术语:数据区,堆,栈,静态存储区,静态区,常量区,常变量区,全局区,字符串常量区,静态常量区,静态变量区,文字常量区,代码区等等,初学者被搞得云里雾里.在这里, ...
- gcc 混合连接动态库和静态库
当对动态库与静态库混合连接的时候,使用-static会导致所有的库都使用静态连接的方式.这时需要作用-Wl的方式 gcc test.cpp -L. -Wl,-Bstatic -ltestlib -W ...
- 使用redis的发布订阅模式实现消息队列
配置文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://w ...
- 在Struts2标签s:textfield中显示正确的日期
Java代码 struts2中的日期期输入显示问题 struts2 中的默认的日期输出并不符合我们的中文日常习惯.以下是我知道的在struts2中进行日期格式化输出的几种方式. 1.利用 &l ...
- 用ruby调用执行shell命令
碰到需要调用操作系统shell命令的时候,Ruby为我们提供了六种完成任务的方法: 1.Exec方法: Kernel#exec方法通过调用指定的命令取代当前进程: 例子: $ ...
- Java : 传值or传引用?
那看看这句经典名言:O'Reilly's Java in a Nutshell by David Flanagan (see Resources) puts it best: "Java m ...
- JAVA编写简单的日历,输入日期即可查看日历
利用LocalDate输入年月日找出当月日历 直接上代码 import java.time.LocalDate; import java.util.Scanner; public class Cale ...
- js中var与let
问题 for (var iii = 0; iii < 3; iii++) { setTimeout(function(){ console.debug(iii) }, 1000) let let ...
- PECL: configuration option "php_ini" is not set to php.ini location
message similar to: configuration option "php_ini" is not set to php.ini locationYou shoul ...