私はmethod.thisのdrawRectでコーナーグラブ指標を描画する方法がわからないですmycode:ios5のようなコーナーグラブインジケーターをUIViewに描画するにはどうすればいいですか?
- (void)drawRect:(CGRect)rect{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);
CGContextSetLineWidth(context, 0.8f);
CGFloat colX1 = CGRectGetMaxX(rect)/3.0;
CGFloat colX2 = 2*colX1;
CGFloat rowY1 = CGRectGetMaxY(rect)/3.0;
CGFloat rowY2 = 2*rowY1;
CGContextBeginPath(context);
CGContextMoveToPoint(context, colX1, CGRectGetMinY(rect));
CGContextAddLineToPoint(context, colX1, CGRectGetMaxY(rect));
CGContextMoveToPoint(context, colX2, CGRectGetMinY(rect));
CGContextAddLineToPoint(context, colX2, CGRectGetMaxY(rect));
CGContextMoveToPoint(context, CGRectGetMinX(rect),rowY1);
CGContextAddLineToPoint(context, CGRectGetMaxX(rect),rowY1);
CGContextMoveToPoint(context, CGRectGetMinX(rect),rowY2);
CGContextAddLineToPoint(context,CGRectGetMaxX(rect),rowY2);
CGContextStrokePath(context);}
とinitメソッドで:
CATiledLayer *tiledLayer = (CATiledLayer *)[self layer];
tiledLayer.levelsOfDetail = 4;
self.layer.borderColor = [UIColor whiteColor].CGColor;
self.layer.borderWidth = 1.5;
私のスクリーンショットです:
私はこのように私のビューを描く方法を知りたいです:
私は本当にコーナーグラブインジケーターを描画するコードを知りたい。
ありがとうございます!