//
// MyCutomView.m
// QuartzCoreTest
//
// Created by qianyb on 15/4/9.
// Copyright (c) 2015年 vic. All rights reserved.
//
#import "MyCutomView.h"
@implementation MyCutomView{
//保存之前触摸接触的点
NSMutableArray *lines;
//临时保存本次触摸所有接触的点
NSMutableArray *pointsTemp;
}
- (instancetype)init{
if (self = [super init]) {
lines = [NSMutableArray array];
pointsTemp = [NSMutableArray array];
return self;
}
return nil;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
*/
- (void)drawRect:(CGRect)rect {
//使用UIKit提供的函数获取当前操作的context
CGContextRef context = UIGraphicsGetCurrentContext();
//设置线条帽样式
CGContextSetLineCap(context, kCGLineCapRound);
//设置线条连接处的样式
CGContextSetLineJoin(context, kCGLineJoinRound);
//设置线条粗细
CGContextSetLineWidth(context, 5);
//设置颜色
CGCont
IOS 画板(签字板)的实现
最新推荐文章于 2020-12-23 15:02:14 发布