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