苹果再一次调皮了。
- (void)drawRect:(CGRect)dirtyRect
{
CGRect bounds = [self bounds];
CGContextRef context = UIGraphicsGetCurrentContext();
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
size_t bytesPerRow = 4 * roundf(bounds.size.width);
context = CGBitmapContextCreate(NULL, roundf(bounds.size.width), roundf(bounds.size.height), 8, bytesPerRow, space, kCGBitmapAlphaInfoMask);
// ...
}
- (void)drawRect:(CGRect)dirtyRect