开发者

Detect anytouch inside subView (other than a button) touchesEnded

I have a subview, which also contains a UIButton. Now, once I enter the touchesEnded, I want to exec开发者_JAVA技巧ute some instructions only if the main subview was touched (and not the UIButton).

Is there a way to do this??

Thanks in advance. ezbz


Use write your logic using these events ,by comparing the coordinates accordingly .

   -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

    }
    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
        UITouch *aTouch = [touches anyObject];
        CGPoint point = [aTouch locationInView:self.view];
        NSLog(@"X%f",point.x);
    }

    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{

    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜