Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Iphone中设置操作优先级?_Iphone_Action - Fatal编程技术网

如何在Iphone中设置操作优先级?

如何在Iphone中设置操作优先级?,iphone,action,Iphone,Action,例如,我有一个按钮,当点击这个按钮时,它调用一个动作:doAction1。 还有一个视图:当触摸它时,它称为动作doAction2 当点击这个按钮时,我也触摸了视图。 调用doAction1或doAction2是否具有设置优先级的属性?我假设您在容器视图中放置了TapGestureRecograyer。如果用户点击按钮,您可以忽略点击手势。只需覆盖愚弄方法 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer sho

例如,我有一个按钮,当点击这个按钮时,它调用一个动作:doAction1。 还有一个视图:当触摸它时,它称为动作doAction2

当点击这个按钮时,我也触摸了视图。
调用doAction1或doAction2是否具有设置优先级的属性?

我假设您在容器视图中放置了TapGestureRecograyer。如果用户点击按钮,您可以忽略点击手势。只需覆盖愚弄方法

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
// test if touched view is unbutton

    if ([touch.view isKindOfClass:[UIButton class]]) 
    {

        return NO; // ignore the touch
    }

return YES; 

}

是的,您可以设置操作的优先级。我建议使用和NSOperationQueue来管理后台活动,您需要能够任意取消这些活动并设置优先级。看见