【问题标题】:Pop-up message on macOS programmingmacOS 编程弹窗提示
【发布时间】:2013-08-08 01:59:22
【问题描述】:

就像在 iOS 上使用 UIAlertView。在 macOS 上创建弹出消息应该有类似的解决方案。试图搜索,但找不到任何有用的东西。

【问题讨论】:

    标签: xcode macos popup


    【解决方案1】:

    您要查找的课程是NSAlert。有关此类的信息可以在其class reference here 中找到。以下是它的用法示例:

    NSAlert *alert = [[NSAlert alloc] init];
    
    [alert setMessageText:@"Some awesome message text"];
    [alert addButtonWithTitle:@"OK"];
    [alert runModal];
    

    【讨论】:

    • 如果您的应用使用 ARC(自动引用计数),则无需调用 autorelease。 ARC 模式现在是大多数 iOS 和 Mac OSX 应用程序的标准。
    猜你喜欢
    • 1970-01-01
    • 2012-09-09
    • 2018-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-18
    • 2018-05-22
    • 2013-08-27
    相关资源
    最近更新 更多