みかづきブログ その3

本ブログは更新を終了しました。通算140万ユーザーの方に観覧頂くことができました。長い間、ありがとうございました。

👆

引越し先はこちらです!

UIViewにまるを描こう。

- (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);
}

若干カンバスに似てるような似てないようなですね。