A
A
Andrey )2015-07-03 16:20:26
Objective-C
Andrey ), 2015-07-03 16:20:26

How to color a UIButton in a specific ratio?

The iOS platform, xcode development environment is considered.
There is a button (let's say green). How to programmatically paint it in a different color in some ratio from left to right or top to bottom? An example in the picture.
d5309cfc23174889901205294040d7de.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
An, 2015-07-03
@XTAZY

There are various options, starting with a vector / raster image and ending with drawInRect
Here is an excellent overview article where we went through everything (except for the CALayer mentioned above)
https://robots.thoughtbot.com/designing-for-ios-ta...
Here's more from Ray only with CoreGraphics www.raywenderlich.com/33330/core-graphics-tutorial...
How to draw two squares, I think you google it yourself
PS Personally, I prefer the option with DRawRect

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question