UIViewに直接図形を描画するにはコンテキストを使う。 CGContextをゲットして、それに対して図形を描いていく。 今回はUIViewのdrawRectメソッドをオーバーライドして描画してみる。 - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // 背景色を透明に self.backgroundColor = UIColor.clearColor; } return self; } /** * UIViewを描画する時に呼ばれる */ - (void)drawRect:(CGRect)rect { [super drawRect:rect]; // 6色 UIColor *colors[6] = { UIColor.redColor, UIColor.orangeC