我正在创建一个带有 finder 同步扩展的可可应用程序。我正在尝试打开有关查找器应用程序的某些事件的对话框。我是 x 代码和目标 c 的初学者。我在某些事件上尝试了以下代码..
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:@"OK"];
[alert addButtonWithTitle:@"Cancel"];
[alert addButtonWithTitle:@"OK"];
[alert addButtonWithTitle:@"Cancel"];
[alert setMessageText:@"Delete the record?"];
[alert setInformativeText:@"Deleted records cannot be restored."];
[alert setAlertStyle:NSWarningAlertStyle];
if ([alert runModal] == NSAlertFirstButtonReturn) {
// OK clicked, delete the record
}
但此代码仅用于显示警报框。谁能建议我如何获得对话框。