阅读背景:

XCode 显示对话框MessageBox about NSAlert

来源:互联网 

XCode 显示对话框MessageBox ? 
 

Key:

M

#import "111AppDelegate.h"

@implementation QXSAppDelegate

@synthesize m_LB_YesNo;
- (void)dealloc
{
    [super dealloc];
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application
}
- (IBAction)OnBT_ShowMessage:(id)sender
{
   //Secord MessageBox
        NSAlert *alert = [[NSAlert alloc] init];
        [alert addButtonWithTitle:@"Yes"];
        [alert addButtonWithTitle:@"No"];
        [alert setMessageText:@"Delete the record?"];
        [alert setInformativeText:@"Deleted records cannot be restored."];
        [alert setAlertStyle:NSWarningAlertStyle];
        
        int  rs = [alert runModal] ;
        
        //NSAlert *alert_msg = [[[NSAlert alloc] init] autorelease];
        
    
        if (rs == NSAlertFirstButtonReturn)
        {
            // OK clicked, delete the record
            //  [self deleteRecord:currentRec];
            //[alert_msg setMessageText:@"Click Yes!"];
            m_LB_YesNo.stringValue = @"Click Yes !";
        }
        else
        {
            //[alert_msg setMessageText:@"Click No!"];
              m_LB_YesNo.stringValue = @"Click No!";
        }
        
        //[alert_msg runModal];
        [alert release];
   
}

@end#imp



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: