我制作了一个自定义圆形视图,如何检测圆形的某些部分或部分。我已经尝试过使用触摸
- (BOOL)validatePoint:(CGPoint)myPoint
{
// calculate how far from centre we are with Pythagorean
// √ a2 + b2
CGFloat a = abs(myPoint.x - (self.bounds.size.width/2));
CGFloat b = abs(myPoint.y - (self.bounds.size.height/2));
CGFloat distanceFromCentre = sqrt(pow(a,2) + pow(b,2));
if((distanceFromCentre > self.minRadiusSize) && (distanceFromCentre < radius)){
return YES;
}else{
// not inside doughnut
return NO;
}
}
但它检测整个我的观点。