UIViewのトップに青いボーダーを入れる方法
はじめに
こんにちは ビンゴ中西です。
Objective-Cで描画を頑張る場合、
drawRectメソッドを使うことになると思います。
サンプルソース
-(void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); // コンテキストを取得 CGContextSetRGBStrokeColor(context, 0.0, 255.0/255, 0.0, 1.0); CGContextSetLineWidth(context, 2.0); CGContextMoveToPoint(context, 0, 0); // 始点 CGContextAddLineToPoint(context, self.frame.size.width, 0); // 終点 CGContextStrokePath(context); // 描画! }
色をつけるとき255で割るのを忘れるとはまります。