Possible Duplicate:
UIButton: how to center an image and a text using imageEdgeInsets and titleEdgeInsets?
I'm customizing the placement of the image and label of my UIButton but it's only set on the initial state. What the hack, how do I ensure the positioning for all 4 button states?
This is the code I'm using. The poisoning works for the first state but gets reset on the other states.
CGRect imgRect = reviewsButton.imageView.frame;
imgRect.origin.x = 10;
imgRect.origin.y += 4;
reviewsButton.imageView.frame = imgRect;
CGRect lblrect = reviewsButton.titleLabel.frame;
lblrect.origin.x = 85;
reviewsButton.titleLabel.frame = lblrect;
[reviewsButton setBackgroundColor:[UIColor colorWithRed:0.192 green:0.198 blue:0.206 alpha:0.15]];