Text Box of Xcode Cocoa program MessageBox
I believe that many Windows programmers are used to the MessageBox pop-up prompt, and there are pop-up methods similar to MessageBox in MacOS.
Method 1
// Other bullet box types NSAlert * alert = [[NSAlert alloc] init]; // [alert addButtonWithTitle: @ "OK"]; // [alert addButtonWithTitle: @ "Cancel"]; [alert setMessageText: @ "test? "]; // [Alert setInformativeText: @" Deleted records cannot be restored. "]; // [alert setAlertStyle: NSWarningAlertStyle]; // [alert setHelpAnchor: @" ddd "]; // [alert setInformativeText: @" asdfa "]; // [alert setMessageText: strMsg];/* [alert setting: _ window modalDelegate: self didEndSelector: @ selector (alertDidEnd: returnCode: contextInfo :) contextInfo: nil]; */[alert runModal];
Method 2
CFOptionFlags result; NSString *strMsg = [NSString stringWithFormat:@"%i", 234]; CFStringRef* msg_ref; CFUserNotificationDisplayAlert(0, kCFUserNotificationNoDefaultButtonFlag, NULL, NULL, NULL, CFSTR("Title"), CFSTR("Message"), NULL, NULL, NULL, &result);