- (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code // とりあえず背景を透明に self.backgroundColor = [UIColor colorWithWhite:0 alpha:0]; } return self; } - (void)drawRect:(CGRect)rect { // Drawing code // コンテキストを取得 CGContextRef context = UIGraphicsGetCurrentContext(); // 線の色を取得 CGContextSetRGBStrokeColor(context, 0, 0, 0, 1); // 線の太さを取得 CGContextSetLineWidth(context, 3.0); // 丸を書く CGContextAddEllipseInRect(context, CGRectMake(1.5, 1.5, 94, 94)); // 描画 CGContextStrokePath(context); }
若干カンバスに似てるような似てないようなですね。