#define kCustomAlert @"UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Alert Back" message:msg delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];[alert show];"
Run Code Online (Sandbox Code Playgroud)
在你的pch文件中声明这个宏:
#define kCustomAlert() [[[UIAlertView alloc] initWithTitle:@"Alert Title" message:@"Alert Message" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]
Run Code Online (Sandbox Code Playgroud)
宏调用: kCustomAlert();
带参数的警报宏:
#define kCustomAlertWithParam(title,msg) [[[UIAlertView alloc] initWithTitle:title message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]
kCustomAlertWithParam(@"This is Title",@"This is message");
Run Code Online (Sandbox Code Playgroud)
带参数和目标的警报宏(用于:UIAlertView委托方法)
Please set UIAlertViewDelegate for your Controller.
#define kCustomAlertWithParamAndTarget(title,msg,target) [[[UIAlertView alloc] initWithTitle:title message:msg delegate:target cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]
kCustomAlertWithParamAndTarget(@"This is Title",@"This is message",self);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
873 次 |
| 最近记录: |