自定义UIAlertView第三方类库

http://www.superqq.com/blog/2015/10/30/two-nice-uialertview/

UIAlertView大家都不陌生了。UIAlertView不可以添加控件,比如说:UILabel、UITextView等等,所以遇到这个需求,一般都要自定义UIAlertView来解决。

我再github上找到了两个非常错的自定义UIAlertView第三方类库,分别是:LMAlertView和CustomIOSAlertView。

LMAlertView使用简介

LMAlertView在github上有610个star。说明这个第三方的UIAlertView还不错,我大概看了一下用法也比较简单。

来看看两个个案例效果:

1

2

用CocoaPods安装LMAlertView

pod 'LMAlertView'

使用案例

LMAlertView *alertView = [[LMAlertView alloc] initWithTitle:@"iOSDevTip"
                                        message:@"关注一下"
                                       delegate:nil
                              cancelButtonTitle:@"ok"
                              otherButtonTitles:nil];

// Add your subviews here to customise
UIView *contentView = alertView.contentView;

[alertView show];   

LMAlertView还保持着UIAlertView的创建方法,作者还比较用心。

CustomIOSAlertView使用简介

CustomIOSAlertView比LMAlertView的star还多一些,有861个。同样我们先看一下效果:

3

用CocoaPods安装CustomIOSAlertView

pod 'CustomIOSAlertView', '~> 0.9.3'

使用案例

CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init];  UIView *customView ..;

[alertView setContainerView:customView];
[alertView show];

CustomIOSAlertView可以设置代理,还可以通过block来实现按钮的点击事件。功能相对比较齐全。

喜欢的童鞋可以star一下,以备不时之需。如果你觉得不错,记得分享给更多朋友哈,谢谢!


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值