使用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的更多相关文章

  1. github上所有大于800 star OC框架

    https://github.com/XCGit/awesome-objc-frameworks#awesome-objc-frameworks awesome-objc-frameworks ID ...

随机推荐

  1. CFLAGS CPPFLAGS CPPFLAGS 区别

    CPPFLAGSC预处理器参数.( C 和 Fortran 编译器也会用到). CXXFLAGSC++语言编译器参数. CFLAGSC语言编译器参数.

  2. 初识Docker和安装

    什么是Docker Docker的构想是要实现“Build,Ship and Run Any App,Anywhere”,即通过对应用的封装(Packaging).分发(Distribution).部 ...

  3. 生成类似于MongoDB产生的ObjectId

    package com.jt.boot.utils; import com.google.common.base.Objects; import java.net.NetworkInterface; ...

  4. postgresql 匿名函数(单独执行代码段)

    do LANGUAGE plpgsql $$ declare top integer; row_org dbo.a_org_type%rowtype; begin /* Insert real cod ...

  5. Abp中SwaggerUI的接口文档添加上传文件参数类型

    在使用Swashbuckle上传文件的时候,在接口文档中希望看到上传控件,但是C#中,没有FromBodyAttribute这个特性,所以需要在运行时,修改参数的swagger属性.   首先看下,最 ...

  6. 导出为shape文件

    private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)//导出为s ...

  7. 另一个SqlParameterCollection中已包含SqlParameter(转)

    一般情况下,我们定义的一个SqlParameter参数数组,如: SqlParameter[] parms =             {                new SqlParamete ...

  8. [日常] nginx访问频率限制

    去年的事,随便记记 ========================================================================= 2017年3月15日 记录: n ...

  9. SSH框架中NoSuchMethodError: antlr.collections.AST.getLine()的解决方案

    问题: 当配置好SSH框架后,使用Hibernate的Query功能时发生如下异常: NoSuchMethodError: antlr.collections.AST.getLine() 原因: St ...

  10. SpringMVC+MyBatis+MySQL 8小时链接断开

    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is ...