以下は、UITextView にコーナーを描画するコードです。
.h ファイル内:
@property(nonatomic,strong) UIBezierPath * upperLeft;
@property(nonatomic,strong) UIBezierPath * upperRight;
- (void)drawRect:(CGRect)rect
{
upperLeft = [UIBezierPath bezierPathWithArcCenter:CGPointMake(xCorner + margin, yCorner + margin)
radius:5.5
startAngle:0
endAngle:DEGREES_TO_RADIANS(360)
clockwise:YES];
[[UIColor blackColor]setFill];
[upperLeft fill];
[upperLeft closePath];
upperRight = [UIBezierPath bezierPathWithArcCenter:CGPointMake(xCorner+ widths - margin, yCorner + margin)
radius:5.5
startAngle:0
endAngle:DEGREES_TO_RADIANS(360)
clockwise:YES];
[[UIColor blackColor]setFill];
[upperRight fill];
[upperRight closePath];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
touchStart = [[touches anyObject] locationInView:self];
isResizingUL = [upperLeft containsPoint:touchStart];
isResizingUR= [upperRight containsPoint:touchStart];
}
初めてパスをタップすると、ブール値がyesになります。しかし、その後のヒットでは、どのパスにも値 NO が与えられます。パスでヒットしたとしても。なぜそれが起こっているのか、誰でも私を助けることができますか?