【文件属性】:
文件名称:ios-封装系统的alert--好用的alert.zip
文件大小:66KB
文件格式:ZIP
更新时间:2022-07-31 13:44:04
弹出视图
系统的UIAlert不太好用,写起来感觉太零散.
使用方法:case 0:
[LTAlertView showTitle:@"LTAlert" message:@"我是普通alert" ButtonTitles:@[@"确认",@"取消"] OnTapBlock:^(LTAlertView* alert,NSInteger num) {
NSLog(@"点击了第%d个按钮",num);
}];
break;
case 1:
[LTAlertView showConfigBlock:^(LTAlertView *alertView) {
alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
} Title:@"LTAlert" message:@"带密码输的alert" ButtonTitles:@[@"确定",@"取消"] OnTapBlock:^(LTAlertView* alert,NSInteger num) {
NSString* str = [alert textFieldAtIndex:0].text;
NSLog(@"输入的文字是%@,点击了第%d个按钮",str,num);
}];
break;
case 2:
[LTAlertView showConfigBlock:^(LTAlertView *alertView) {
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
} Title:@"LTAlert" message:@"带输入的alert" ButtonTitles:@[@"确定",@"取消"] OnTapBlock:^(LTAlertView* alert,NSInteger num) {
NSString* str = [alert textFieldAtIndex:0].text;
NSLog(@"输入的文字是%@,点击了第%d个按钮",str,num);
}];
break;
case 3:
[LTAlertView showConfigBlock:^(LTAlertView *alertView) {
alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
alertView.backgroundColor = [UIColor redColor];
} Title:@"LTAlert" message:@"弹出带输入的alert" ButtonTitles:@[@"确定",@"取消"] OnTapBlock:^(LTAlertView* alert,NSInteger num) {
NSString* accountStr = [alert textFieldAtIndex:0].text;
NSString* passwordStr =[alert textFieldAtIndex:1].text;
NSLog(@"账号是%@,密码是%@",accountStr,passwordStr);
}];
break;
【文件预览】:
LTAlertView
----LTAlertView()
--------ViewController.m(2KB)
--------Info.plist(1KB)
--------main.m(331B)
--------Base.lproj()
--------LTAlertView.m(2KB)
--------ViewController.h(212B)
--------AppDelegate.h(274B)
--------Assets.xcassets()
--------LTAlertView.h(678B)
--------AppDelegate.m(2KB)
----LTAlertView.xcodeproj()
--------project.xcworkspace()
--------xcuserdata()
--------project.pbxproj(21KB)
----.git()
--------logs()
--------info()
--------index(2KB)
--------COMMIT_EDITMSG(15B)
--------objects()
--------HEAD(23B)
--------config(144B)
--------refs()
--------hooks()
--------description(73B)
----LTAlertViewUITests()
--------LTAlertViewUITests.m(1KB)
--------Info.plist(733B)
----LTAlertViewTests()
--------Info.plist(733B)
--------LTAlertViewTests.m(908B)