我已经在我的View Controller中添加了一个UIView。我将其子类设置为newDrawingView.h文件。
//
// newDrawingView.m
// slate
//
// Created by Monica Kachlon on 12/2/17.
// Copyright © 2017 ma. All rights reserved.
//
#import "newDrawingView.h"
@implementation newDrawingView
UIBezierPath *newPath;
CAShapeLayer * layerStyle;
- (void)startTouch:(CGPoint)point;
{
[newPath moveToPoint:point];
}
- (void)drawRect:(CGRect)rect {
NSLog(@"DRAWING");
}
- (void)drawShape:(CGPoint)point
{
[newPath addLineToPoint: point]; // (4)
[self setNeedsDisplay];
}
- (void)endTouch:(CGPoint)point {
[newPath removeAllPoints];
}
@end
我设法处理startTouch,drawShape和endTouch。但是,当我调用self setNeedsDisplay时 - 我的drawRect不会被调用..