내가 uibezierpath
- (void)drawRect:(CGRect)rect
{
CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(contextRef, 2.0);
CGContextSetRGBFillColor(contextRef, 0, 0, 1.0, 1.0);
CGContextSetRGBStrokeColor(contextRef, 0, 0, 1.0, 1.0);
CGRect circlePoint = (CGRectMake(self.bounds.size.width/3, self.bounds.size.height/2, 200.0, 200.0));
CGContextFillEllipseInRect(contextRef, circlePoint);
}
UIView의
의 서브 클래스에서의 drawRect 함수에서 원을 그리기하고 나는 그것이 tappable 수 있도록 원에 제스처 인식기를 추가 할에 의해 그려진 모양 제스처 인식기를 추가하는 방법UITapGestureRecognizer *singleFingerTap =
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSingleTap:)];
[self.view addGestureRecognizer:singleFingerTap];
나는 큰 원이 될 위치에 (스토리 보드) 뷰 위에 UIGestureRecognizer을 끌어 생각하지만 원은 UIGestureRecognizer 위젯보다 훨씬 크다.
코드를 결합하거나 UIGestureRecognizer를 원의 크기와 위치와 정확히 같은보기 영역에 할당하려면 어떻게해야합니까?
감사합니다. .h 파일에 "self.shape"유형은 무엇입니까? – Leahcim
@Leahcim, "@property (strong, nonatomic) UIBezierPath * 모양; – rdelmar
감사합니다. UIBezierPath에 대해 알고 있어야합니다. – Leahcim