1wyoeg
Last Updated: February 25, 2016
·
1.861K
· yorirou
6070c18b2f3de0155705b277bbd43f2b

Filling a UIView with one color.

Don't do it with UIBezierPath, because it's slow.

A much faster way:

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetRGBFillColor(context, 0.f, 0.f, 0.f, 1.f);
CGContextFillRect(context, [self bounds]);
Say Thanks
Respond

2 Responses
Add your response

352

Why not use UIView.backgroundColor?

over 1 year ago ·
12520
8e252e4b5e8a2ae47e736367015ce7a8

freerunnering, because it might be changed by UIKit, for example, if a view is in UITableViewCell, and when that cell gets selected - UIKit will set all that's cell subviews' background color to cell selected color.

over 1 year ago ·