Skip to content

Instantly share code, notes, and snippets.

@akey7
Created December 4, 2013 23:33
Show Gist options
  • Save akey7/f88bd691492062ba488a to your computer and use it in GitHub Desktop.
Save akey7/f88bd691492062ba488a to your computer and use it in GitHub Desktop.
How to make a button with a label and then size it to fit.
UIButton *button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button2.frame = CGRectMake(10, 100, 100, 75);
[button2 setTitle:@"supercalifragelisticexpialidocious" forState:UIControlStateNormal];
[button2 sizeToFit];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment