iOS判断点击的区域在某个控件之外的方法

/**
 *  重写touchesEnded方法
 */
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    if ([touches anyObject].view != _btnMenu) {
        // 判断点击的区域如果不是菜单按钮_btnMenu, 则关闭菜单
        [self closeDropDownMenu];
    }
}

你可能感兴趣的:(iOS判断点击的区域在某个控件之外的方法)