power_N_9
power_N_9

Reputation: 35

OSX - NSButton: set inset of checkbox to title label

I've got an NSButton as a checkbox, and I'd like to set the inset to the title label. Instead of this...

Something like this

Any ideas? In iOS, it can be set via the IB, in OSX apparently not.

Upvotes: 1

Views: 1133

Answers (1)

Eugene Mankovski
Eugene Mankovski

Reputation: 1180

Sadly there is nothing in IB for that. So you should do it in the code:

    let paragraphStyle = NSMutableParagraphStyle()
    paragraphStyle.firstLineHeadIndent = 20.0

    checkButton.attributedTitle = NSAttributedString(string: checkButton.title, attributes: [NSParagraphStyleAttributeName : paragraphStyle])

Here is how it looks then:

enter image description here

Upvotes: 5

Related Questions