摘要: 1 - (IBAction)captureView:(UIButton *)sender { 2 3 // 延迟1 ~2 秒之后再截屏 4 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NS... 阅读全文
posted @ 2016-01-23 15:51 xiaocaoera 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 1 // 当手指在view上移动的时候调用 2 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 3 { 4 5 UITouch *touch = [touches anyObject]; 6 ... 阅读全文
posted @ 2016-01-23 15:41 xiaocaoera 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 1 #import 2 3 @interface UIImage (NJ) 4 /** 5 * 生成头像 6 * 7 * @param icon 头像图片名称 8 * @param border 头像边框大小 9 * @param color 头像边框的颜色10 *1... 阅读全文
posted @ 2016-01-23 12:37 xiaocaoera 阅读(363) 评论(0) 推荐(0) 编辑
摘要: 1 - (void)drawRect:(CGRect)rect 2 { 3 // 1.获取上下文 4 CGContextRef ctx = UIGraphicsGetCurrentContext(); 5 6 // 2.创建路径(一个path就代表一条路径) 7 ... 阅读全文
posted @ 2016-01-23 11:48 xiaocaoera 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 1 @implementation NJView 2 3 /* 4 -(void)awakeFromNib 5 { 6 7 NSLog(@"awakeFromNib"); 8 // 创建CADisplayLink, 默认每秒60次 9 CADisplayLink *di... 阅读全文
posted @ 2016-01-22 23:41 xiaocaoera 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 1 - (void)drawRect:(CGRect)rect 2 { 3 // Drawing code 4 5 // 画圆, 以便于以后指定可以显示内容范围 6 CGContextRef ctx = UIGraphicsGetCurrentContext();... 阅读全文
posted @ 2016-01-22 22:22 xiaocaoera 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 1 - (void)drawRect:(CGRect)rect 2 { 3 // 画四边形 4 CGContextRef ctx = UIGraphicsGetCurrentContext(); 5 6 // 保存上下文 7 CGContextSaveGS... 阅读全文
posted @ 2016-01-22 22:02 xiaocaoera 阅读(418) 评论(0) 推荐(0) 编辑
摘要: 1 - (void)drawRect:(CGRect)rect 2 { 3 // 获取上下文 4 CGContextRef ctx = UIGraphicsGetCurrentContext(); 5 6 // 保存一份最纯洁的图形上下文 7 // 调用一次该方法... 阅读全文
posted @ 2016-01-22 18:43 xiaocaoera 阅读(633) 评论(0) 推荐(0) 编辑
摘要: // controllerX,controllerY是弧形起始点的坐标,endX,endY是结束点的坐标CGContextAddQuadCurveToPoint(ctx, controllerX, controllerY, endX, endY); 阅读全文
posted @ 2016-01-22 15:56 xiaocaoera 阅读(269) 评论(0) 推荐(0) 编辑
摘要: // 1.获取上下文 CGContextRef ctx = UIGraphicsGetCurrentContext(); // 2.画饼状图 // 画线 CGContextMoveToPoint(ctx, 100, 100); CGContextAddLineT... 阅读全文
posted @ 2016-01-22 15:27 xiaocaoera 阅读(1067) 评论(0) 推荐(0) 编辑