Post

Replies

Boosts

Views

Activity

Position image inside UIButton
Hi, I have added a square image inside a UIButton. The goal is to have the square image on the left of the button, with space margin around 4 sides of button = 5. Here is the code: button.imageView?.contentMode = .scaleAspectFit button.contentHorizontalAlignment = .left; button.imageEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5) and here is the result: You can notice several problems: Right margin is > 5 (between button and text) Left margin > 5 The rest, aspect, and top and bottom margins are fine. How to have this button well on the left, and the text right next to it?
0
0
3.0k
Jun ’21