Created
January 19, 2012 09:55
-
-
Save zeedark/1639124 to your computer and use it in GitHub Desktop.
Resize a UIButton according to its title's length.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Resize a UIButton according to its title's length. | |
CGSize stringSize = [self.myButton.titleLabel.text sizeWithFont:self.myButton.titleLabel.font]; | |
CGRect frame = self.myButton.frame; | |
frame.size.width = stringSize.width; | |
[self.myButton setFrame:frame]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment