iPhone : How to set BackgroundColor of UIButton with buttonType UIButtonTypeCustom

前端 未结 15 1467
有刺的猬
有刺的猬 2020-12-01 13:45

i want to change the button color when it is clicked. I used :

[button setBackgroundColor:[UIColor redColor]];

but this shows red color onl

15条回答
  •  我在风中等你
    2020-12-01 14:39

    You should set UIButton's type to custom and set its image or background image properties for normal and highlighted states.

    For professional and nice looking buttons that you can easily use in your apps this custom button component may also help.

提交回复
热议问题