Friday, February 12, 2010

Drawing circle on UIView :iphone

Drawing circle on UIView.

Circle.h

#import

@interface Circle : UIView {


}

@end

Circle.m

#import "Circle.h"

@implementation Circle

- (id)initWithFrame:(CGRect)frame {

if (self = [super initWithFrame:frame]) {

// Initialization code

}

return self;

}

- (void)drawRect:(CGRect)rect {

CGRect leftOval = {10, 160, 70, 70};

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 0.5);

CGContextAddEllipseInRect(context, leftOval);

CGContextFillPath(context);

}

- (void)dealloc {

[super dealloc];

}

@end

No comments:

Post a Comment