1
私のiPhoneアプリのカスタムUIViewクラスで、このdrawRectメソッドの何が問題になっていますか?それは色のついた円を描くことになっていますが、適切な幅と高さの黒い四角形を描きます。iPhone App - CGContextサークルが黒い四角形のように見えるのはなぜですか?
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
UIColor *c = [UIColor redColor];
const CGFloat *components = CGColorGetComponents([c CGColor]);
CGFloat red = components[0];
CGFloat green = components[1];
CGFloat blue = components[2];
CGFloat al = components[3];
CGContextSetRGBFillColor(context, red, green, blue, al);
CGContextFillEllipseInRect(context, CGRectMake(x, y, width, width));
}