ZZCustomAlertView - 一个高度自定义的iOS模态弹窗

这是一个可以高度自定义的iOS模态弹窗 (modal alert view)。

项目地址:https://github.com/zzdjk6/ZZCustomAlertView

Github 项目里包含一个 Example 的 Demo 示例。

使用Cocoapod:

pod "ZZCustomAlertView"

这里是 Demo 效果视频: http://v.youku.com/v_show/id_XMTI3NDQyODk3Mg==.html

简明用法

总的来说,你可以将完全自定义的一个 View 作为 ZZCustomAlertView 的 contentView,并可以设置阴影的颜色、透明度、是否模糊背景、是否允许点击背景隐藏弹窗等参数。

如下代码将创建在 Demo 中看到的默认弹窗。

ZZCustomAlertView *alert = [ZZCustomAlertView alertViewWithParentView:self.view andContentView:nil];
[alert show];

如下代码将创建在 Demo 中看到的自定义弹窗。

UIImage *img = [UIImage imageNamed:@"Perfect Button"];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(0, 0, img.size.width, img.size.height);
[btn setImage:img forState:UIControlStateNormal];
[btn addTarget:self action:@selector(customButtonPressed) forControlEvents:UIControlEventTouchUpInside];

ZZCustomAlertView *alert = [ZZCustomAlertView alertViewWithParentView:self.view andContentView:btn];
alert.shouldBlurBackground = YES;
alert.allowTapBackgroundToDismiss = NO;
alert.shadowColor = [UIColor whiteColor];
alert.shadowAlpha = 0.1f;
[alert show];

更多详情请访问 Github 项目地址: https://github.com/zzdjk6/ZZCustomAlertView

转载于:https://my.oschina.net/zzdjk6/blog/472726

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值