UIBezierPath型とUIColor型の2つのメンバー変数を使用してmyBezierPathsというクラスを作成し、このクラスのオブジェクトを使用してbezierpathを描画しようとしましたが、bezierpathを取得できません。以下は私のコードです。
//Bezierpath.h
@interface BezierPath : NSObject
{
UIBezierPath *m_bezierPath;
UIColor *m_pathColor;
}
@property (nonatomic, strong) UIBezierPath *bezierPath;
@property (nonatomic, strong) UIColor *pathColor;
@end
//drawingView.m
- (void)drawRect:(CGRect)rect
{
for (BezierPath *pathobj in m_pathArray)
{
[pathobj.pathColor setStroke];
[pathobj.pathColor setFill];
[pathobj.bezierPath strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];
}
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
*self.myPath = [[BezierPath alloc] init];*
myPath.bezierPath.lineWidth = 5;
myPath.bezierPath.lineCapStyle = kCGLineCapRound;
myPath.bezierPath.flatness = 0.0;
myPath.bezierPath.lineJoinStyle = kCGLineJoinRound;
myPath.bezierPath.miterLimit = 200.0;
self.myPath.pathColor = [UIColor redColor];
UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
[myPath.bezierPath moveToPoint:[mytouch locationInView:self]];
[m_pathArray addObject:self.myPath];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
[self.myPath.bezierpath addLineToPoint:[mytouch locationInView:self]];
[self setNeedsDisplay];
}
返事を待って、私の説明がはっきりしていることを願っています
よろしくランジット