UIButton のPaddingにハマった件。

iOS

UIButtonのデフォルト設定されてる余白をどうにか取り除かならなくて、やり方分からず数時間消えた。

UIButton: Padding Between Image and Text
Pop quiz: in a UIButton, how do you set a padding of 10pt between the image and the title? I had to do this at work recently, and I was surprised at how hard it...

海外のサイトだがマジでわかりやすかった。

Xcode(StoryBoard) 側の設定で content EdgeInsets の上下を-5ずつ設定してあげて実現。

こんな単純なことだったが、ハマるととんでもない時間を持ってかれるのね。

未来の自分が困ったら、過去の自分が解決したよ、という思いを込めて備忘録的に書いた。

タイトルとURLをコピーしました