Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

drf1229

macrumors regular
Original poster
Jun 22, 2009
237
0
I'm trying to detect if a UIView inside of another view is touched. I have something like this:
Code:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch=[touches anyObject];
if([touch view]==myview]){
//Do this code... 


}

}
But it never detects it. Do I need to do something else? I could call touchesMoved within the subview, but then I can't detect if the touch moves outside the view. Any suggestions? Any advice is greatly appreciated!
 
Oh wow. I just figured out that when I call touchesMoved in the subview, I could use superview to access a method in the superview, which could then do the action I want. Wish i'd figured it out earlier! Thanks anyway
 
Out of curiousity is there a way to solve this problem without doing this?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.