swift - 以编程方式增加 NSAlert 的字体大小

标签 swift xcode macos cocoa nsalert

我似乎无法增加我的 NSAlert 的字体大小 - 甚至整个框的大小。

else if array[arraycount].containsString("Error: error.") {
   let myPopup: NSAlert = NSAlert()
   myPopup.alertStyle = NSAlertStyle.WarningAlertStyle
   myPopup.addButtonWithTitle("I've Called!")
   myPopup.informativeText = "Sorry, we weren't able to that. Please Call Support 1(800)234-4567 ext: 12345"
   myPopup.runModal()
   let app = NSRunningApplication.currentApplication()                           
   app.activateWithOptions(.ActivateIgnoringOtherApps)
 }

这是我当前的代码,运行良好,但我将在 iMac 上运行我的 OS X 应用程序,文本看起来非常小。我想以编程方式增加点大小,但我在 Swift 中找不到任何相关信息。任何帮助将不胜感激!

最佳答案

不要设置informativeText,那真的很小。

相反,设置messageText。这更大,更大胆。

更好的是,两者都设置,这样更重要的信息就大而粗,不太重要的信息就小。

myPopup.messageText = "Sorry, we weren't able to that."
myPopup.informativeText = "Please Call Support 1(800)234-4567 ext: 12345"

关于swift - 以编程方式增加 NSAlert 的字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38661157/

相关文章:

SwiftUI :Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, 子代码=0x0)

linux - 如何利用硬件参数唯一标识一个设备?

ios -\[MediaRemote\] 错误操作需要注册客户端回调。请求播放队列

ios - 用字典数据填充 UITableView (Swift)

xcode - 告诉 Xcode 不要在项目上使用自动布局

iOS UI 与代码的连接

macos - OS X Yosemite curl 错误

c - 总线错误: 10 in bison and flex on mac os

swift - 在 iOS 10 上使用 UNUserNotificationCenter

ios - Swift NSJSONSerialization.JSONObjectWithData() 无法仅读取 "OK"字符串的数据