I change the text of one of my buttons, I didn't realize that the text wasn't centered.
Its set in IB
How do I center it ?
I change the text of one of my buttons, I didn't realize that the text wasn't centered.
Its set in IB
How do I center it ?
It's just a text label so this should work (put it in your viewDidLoad method and set myButton as an IBOutlet property)
myButton.titleLabel.textAlignment = UITextAlignmentCenter;
However, it should already be centered - it seems odd that it isn't. Are you doing anything else unusual?
In Interface Builder, select the button and press ⌘-1 to bring up the attributes inspector. Look towards the bottom of the attributes, under "Control". You will see something that says "Content" with alignment buttons. Press the button for center alignment.