0
点击一个按钮,我使用下面的代码在Mac应用程序警报OK按钮不起作用
testViewController *myWindowController = [[testViewController alloc] initWithWindowNibName:@"RecordingsViewController"];
[myWindowController setDelegate:self];
activeModalWindow = [myWindowController window];
[NSApp beginSheet:[myWindowController window]
modalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:nil];
[NSApp runModalForWindow:[myWindowController window]];
[[myWindowController window] orderOut: self];
从这个testViewController,我显示警报使用的代码
NSString *theAlertMessage = [NSString stringWithFormat: @"Already added"];
NSRunAlertPanel(@"", theAlertMessage, @"OK", nil, nil);
但点击此提醒的确定按钮。我的警报仍在屏幕上。请帮忙!
奇怪,这对我有用,你在调试器控制台中是否有错误/警告信息? –
没有错误/警告 – Swastik
你可以请尝试用简单的框架使用NSRunAlertPanel来构建新的项目,以验证其系统中的功能? (为了排除这个问题只在这个项目中出现的可能性) –