我决定使用带有 2 个按钮的警报表。当用户点击继续按钮时,一个由窗口制成的工作表应该下来。工作表下来,父窗口与另一张工作表一起关闭。我正在使用的代码是:
- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(int *)contextInfo
{
if (returnCode == kOkayButtonCode) {
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString *status = [defaults objectForKey:@"userStatus"];
if (status == @"NO") {
[NSApp beginSheet:theSheet modalForWindow:window
modalDelegate:self didEndSelector:NULL contextInfo:nil];
}
if (status == @"YES") {
}
}
if (returnCode == kCancelButtonCode) {
[NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.45];
}
}
任何人都可以看到这个问题吗?