For iOS7, I used the UIButton
titleLabel.frame.size.width
property to determine the width of my button title under different localisations so I could p
I resolved it. App run on iOS8, build by Xcode 6, not update frame right after UIButton setTitle
, setTitleEdgeInsets
. It will wait for next UI update. So, if you get frame of titleLabel, you will get CGRectZero.
Solution:
Call below methods after set UI property, to update layout immediately:
[self setNeedsLayout];
[self layoutIfNeeded];
Or:
titleFrame
, use self.titleLabel.frame
.Or: