swiftxcodemacoscocoansalert

Programmatically increase font size for NSAlert


I can't seem to increase the font size of my NSAlert - or even the size of the entire box.

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)
 }

This is my current code which works fine, but I will be running my OS X application on an iMac and the text looks really small. I was wanting to increase the point size programmatically, but I can't find anything about it in Swift. Any help would be appreciated!


Solution

  • Don't set informativeText, that's really small.

    Instead, set messageText. That's much bigger, and bold.

    Even better, set both, so more important information is big and bold and less important information is small.

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