简体   繁体   中英

colorizing UIbuttons

Does someone know how to colorize a UIButton (iphone)? I have a greyscale image with alpha that I want to colorize to various different colors. Setting things like background color only shade the entire image without respecting the alpha.

Is there a straightforward way to do this, or will I need to subclass UIButton and overload the drawRect method perhaps? Thanks.

One option is to use a one-segment UISegmentedControl , which provides access to a tint property. These can behave like a UIButton with the right settings, and look a lot like the glass-style that Apple uses for its iPhone apps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM