IOS7学习之路九(ios7自定义UIAlertView)

来源:互联网 发布:厦门seo陈仁潘 编辑:程序博客网 时间:2024/05/16 18:20

IOS7的UIAlertView 不支持自定义,无法添加subview .

不过可以用第三方库git上的下载链接    https://github.com/wimagguc/ios-custom-alertview  

Custom iOS7 AlertView

使用方法:

1.下载

2下载之后解压后把其中的

  • CustomIOS7AlertView.h
  • CustomIOS7AlertView.m
两个文件粘贴到自己的项目中。


3.添加头文件

在需要使用UIAlertView的地方,添加头文件。

#import "CustomIOS7AlertView.h"

并且添加协议。<CustomIOS7AlertViewDelegate>
4.添加AlertView

 CustomIOS7AlertView *alertView = [[CustomIOS7AlertView alloc] init];    [alertView setButtonTitles:[NSMutableArray arrayWithObjects:@"取消",@"确定", nil]];//添加按钮    [alertView setContainerView:youcontroller.view];    [alertView show];

运行结果截图:



很简单就不做具体介绍了,大家可以下载Demo看看:http://download.csdn.net/detail/superlele123/6986895

点击右上角Item弹出AlertView.





0 0
原创粉丝点击