In iOS, can we set a UIButton and get its width, or must be set its width and then set its content?
It seems that we can
[someString sizeWithFont:someFont].width
to get a width, and then make it the button’s width (by setting its frame) and then set that title and font. But can we just set a button’s font and title (and autosize the button), and then get the width instead?
Use the
sizeToFitmethod of UIView (http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-SW11)