iOS - Setting UIButton background color only colors the corners

ぐ巨炮叔叔 提交于 2019-11-30 17:30:51

You're using a round rect button which is pretty ugly, and pretty hard to customise.

You can create a custom type button and use a background image, or create a custom type button and round the corners and set the background colour of the layer yourself.

If you want to get really fancy there is a nice tutorial here which can give you any-sized gradient type buttons using layers, no image files required.

What's that button type? If you want to customise button, you gotta create a button with [UIButton buttonWithType:UIButtonTypeCustom]

I discovered this almost by accident:

self.loginButton.tintColor = [UIColor redColor];

Definitely works and has been available since iOS 2.0.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!