My issue is pretty simple yet I can't find a solution. I have a UIButton which has a title and image. I want image position to be fixed no matter what happens so I set it this way:
[button setImageEdgeInsets:UIEdgeInsetsMake(0.f, 0.f, 0.f, IS_IPHONE ? 20.f : 60.f)];
I do not set any position for the button's titleLabel
.
What happens next is I set new title for the button, the title label shrinks or expands to fit new text and surprisingly it makes the image move, so it is obvious that despite applied image edge insets the image position depends on the label's frame. I see two solutions that can be used:
1) Make image independent of label's frame
2) Set fixed size for the label
but I don't know how to implement neither of them. Can you please give me some advice how do I resolve this issue?