/** * 按鈕點(diǎn)擊范圍的方法 */- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {        //首先調(diào)用父類的方法確定點(diǎn)擊的區(qū)域確實(shí)在按鈕的區(qū)域中    BOOL res = [super pointInside:point withEvent:event];    if (res) {        //繪制一個圓形path        UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:self.centerButton.frame];        if ([path containsPoint:point]) {            //如果在path區(qū)域內(nèi),可以接收交互事件,從而截獲父視圖的點(diǎn)擊事件            self.centerButton.userInteractionEnabled = YES;            return YES;                    } else {                        //如果不在path區(qū)域內(nèi),不可以接收交互事件,從而將事件傳給父視圖接收            self.centerButton.userInteractionEnabled = NO;            return YES;        }            }    return NO;}
新聞熱點(diǎn)
疑難解答
圖片精選