NSAlert 弹出警告提示窗

来源:互联网 发布:js两个数组合并去重 编辑:程序博客网 时间:2024/06/05 04:43

-(void)alertinterface:(NSString *)title1 buttonwithtitle:(NSString *)title2 messagetext:(NSString *)messagetext informativetext:(NSString *)informative

{

    NSAlert *alertForNotSelectIcon = [[NSAlert allocinit];

    

    [alertForNotSelectIcon addButtonWithTitle:title1];

    

    [alertForNotSelectIcon addButtonWithTitle:title2];

    

    [alertForNotSelectIcon setMessageText:messagetext];

    

    [alertForNotSelectIcon setInformativeText:informative];

    

    [alertForNotSelectIcon setAlertStyle:NSWarningAlertStyle];

    

    [alertForNotSelectIcon beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:nil contextInfo:nil];

    

}



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//调用

NSString *title1 =NSLocalizedString(@"title1"nil);

        

        NSString *title2 =NSLocalizedString(@"title2"nil);

        

        NSString *messagetext =NSLocalizedString(@"messagetext0"nil);

        

        NSString *informativetext =NSLocalizedString(@"informativetext1"nil);

        

        [self alertinterface:title1 buttonwithtitle:title2 messagetext:messagetext informativetext:informativetext];



/////////////////////////////////////////////////////////////////

//Localizable.strings文件//


。。。。。。

0 0
原创粉丝点击