dimanche 26 avril 2015

Changing a fill color on ellipse using Objective-C


I am overriding drawRect method in order to draw ellipse

- (void)drawRect:(CGRect)rect {

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetLineWidth(context, 2.0);

CGContextSetStrokeColorWithColor(context, [UIColor mainColorYellow].CGColor);

CGRect rectangle = CGRectMake(0.0, 2.0, rect.size.width , rect.size.height - 4.0);

CGContextAddEllipseInRect(context, rectangle);

CGContextStrokePath(context);

}

How can I change fill color on ellipse? I tried using CGContextSetFillColorWithColor(CGContextRef c, CGColorRef color) but without result.


Aucun commentaire:

Enregistrer un commentaire