#import "CGArrow.h"
@implementation CGArrow
- (void)drawRect:(CGRect)rect {
// 绘制
CGContextRef con = UIGraphicsGetCurrentContext();
//线的颜色
CGContextSetStrokeColorWithColor(con,[[UIColor grayColor]CGColor]);
//三角形箭头
//左起点
CGContextMoveToPoint(con, 0, 25);
//中间点
CGContextAddLineToPoint(con, 25, 0);
//右终点
CGContextAddLineToPoint(con, 50, 25);
//竖线 起点
CGContextMoveToPoint(con, 25, 0);
//竖线终点
CGContextAddLineToPoint(con, 25, 50);
//连接所有点
CGContextStrokePath(con);
}
@end
原文:
http://okhjp.com/post/15/ios-app-drawRect-arrow/