自定义UIAlertView第三方类库

来源:互联网 发布:ai mac史蒂芬周 编辑:程序博客网 时间:2024/05/15 00:28

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 customiseUIView *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
原创粉丝点击