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]);
Written by Tamás Demeter-Haludka
Related protips
2 Responses
Why not use UIView.backgroundColor?
over 1 year ago
·
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ios
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#