TSCAlertView
自定义弹框控件(AlertView)
仿照原生的UIAlertView和UIAlertController效果实现。
介绍
TSCAlertView是一个弹框控件,可以自动修改其内容的文本颜色和字体大小,同时允许您自定义内容视图。否则,它还支持在弹框中添加徽标。
屏幕截图
开始使用
- 下载TSCAlertView.h和TSCAlertView.m源代码并将其添加到您的项目中。
- 导入TSCAlertView.h文件。
- 您现在可以在项目中使用了。
使用
普通警告视图
NSMutableArray * titleArr = [NSMutableArray arrayWithObjects:@"取消",@"确定", nil];
TSCAlertView * alert = [[TSCAlertView alloc] initWithTitle:@"退出登录" icon:nil message:@"确定退出登录吗?" buttonTitles:titleArr
buttonEvent:^(NSInteger tag) {
NSLog(@"%ld",(long)tag);
}];
[alert show];
图标警告视图
NSMutableArray * titleArr = [NSMutableArray arrayWithObjects:@"取消",@"确定", nil];
TSCAlertView * alert = [[TSCAlertView alloc] initWithTitle:@"退出登录" icon:[UIImage imageNamed:@"exclamation-icon"] message:@"确定退出登录吗?"
buttonTitles:titleArr buttonEvent:^(NSInteger tag) {
NSLog(@"%ld",(long)tag);
}];
[alert show];
定义内容警告视图
TSCAlertView *alert = [[TSCAlertView alloc] init];
ContentView *contentView = "YOUR DEFINE VIEW";
contentView.frame = "YOUR DEFINE VIEW FRAME TO SHOW";
alert.contentView = contentView;
[alert show];