NSAlert 弹出警告提示窗(新)
来源:互联网 发布:cba球员卧推数据 编辑:程序博客网 时间:2024/05/21 00:48
NSAlert 警告提示窗有以下两种方式展示:
- (IBAction)alertButton:(id)sender {
NSString *title1 =NSLocalizedString(@"Ok", nil);//本地化添加一个Localizable.string文件
NSString *title2 =NSLocalizedString(@"Cancel", nil);
NSString *messagetext =NSLocalizedString(@"messagetext3", nil);
NSString *informativetext =NSLocalizedString(@"Please select the day or the latest", nil);
[self alertSheetFirstBtnTitle:title1 SecondBtnTitle:title2 MessageText:messagetext InformativeText:informativetext];
}
//卷帘式对话框alert:
-(void)alertSheetFirstBtnTitle:(NSString *)firstname SecondBtnTitle:(NSString *)secondname MessageText:(NSString *)messagetext InformativeText:(NSString *)informativetext{
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:firstname];
[alert addButtonWithTitle:secondname];
// [alert addButtonWithTitle:@"chenglibin1"];//可以添加三个按钮
[alert setMessageText:messagetext];
[alert setInformativeText:informativetext];
[alert setAlertStyle:NSWarningAlertStyle];
[alert beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
if (result == NSAlertFirstButtonReturn) {//响应第一个按钮被按下:name:firstname;
//...
NSLog(@"Ok");
}
if (result == NSAlertSecondButtonReturn) {
NSLog(@"Cancel");
}
if (result == NSAlertThirdButtonReturn) {
NSLog(@"chenglibin1");
}
}];
}
//nsalert 采用Modal Window 的方式展示:
-(void)alertModalFirstBtnTitle:(NSString *)firstname SecondBtnTitle:(NSString *)secondname MessageText:(NSString *)messagetext InformativeText:(NSString *)informativetext{
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:firstname];
[alert addButtonWithTitle:secondname];
// [alert addButtonWithTitle:@"chenglibin1"];//可以添加三个按钮
[alert setMessageText:messagetext];
[alert setInformativeText:informativetext];
[alert setAlertStyle:NSWarningAlertStyle];
NSUInteger action = [alert runModal];
//响应window的按钮事件
if(action == NSAlertFirstButtonReturn)
{
NSLog(@"defaultButton clicked!");
}
else if(action == NSAlertSecondButtonReturn )
{
NSLog(@"alternateButton clicked!");
}
else if(action == NSAlertThirdButtonReturn)
{
NSLog(@"otherButton clicked!");
}
}
- NSAlert 弹出警告提示窗(新)
- NSAlert 弹出警告提示窗
- COCOA之NSAlert警告提示框
- 常用的几个弹出警告、提示
- RadControl后台弹出窗口,对话框,警告提示。
- BootStrap 工具提示 弹出框 警告框
- bootstrap中dialog弹出框(警告/提示)
- servlet 提示信息弹出警告框后成功重定向
- servlet 提示信息弹出警告框后成功重定向
- jQuery模拟JS警告、确认、提示弹出对话框效果
- jQuery弹出警告对话框美化插件(警告,确认和提示)
- jQuery弹出警告对话框美化插件(警告,确认和提示)
- layer插件如何在弹出层中弹出一警告提示并关闭弹出层
- mt6735 Audio framework]音量警告提示框选择OK,重启后再增大音量希望还会弹出音量警告提示框
- jQuery,实现想弹出什么,弹出什么(弹出提示、弹出一个新的页面等等)
- bootstrap 三种提示框 (tooltip工具提示+popover弹出框+alert警告框)
- asp.net 右下角弹出新提醒信息提示框
- c#里用VBSCRIPT 的MSGBOX实现弹出窗口提示(而不是警告)图标
- LayoutInflater原理学习笔记
- scrollview中嵌套listview 数据显示不全
- 第七章习题
- spring 切换数据源的实现思路
- python操作MySQL数据库
- NSAlert 弹出警告提示窗(新)
- 动态规划_01背包问题_Java实现
- UIView/UIButton 设置圆角
- Android ListView分类/分组效果 - 第二种实现方式
- Android开发艺术探索学习-View的事件分发机制(二)
- android接入第三方apk的解决方法
- OC中的NSDictionary
- Swift2.1-下标脚本
- bzoj3672: [Noi2014]购票