A beginner’s question:
I’ve created a subview in my view. In that subview I created yet another subview. Each subview fills the entire screen (320×480):
[self.view addSubview:aView]; // 320x480
[aView addSubview:yetAnotherView]; // 320x480
If I understand this correctly, this will lead to the following hierarchy:
- TOP: yetAnotherView
- MIDDLE: aView
- BOTTOM: view
So far so good. My problem is, that I would like to recognise gestures on the very top of these views (whatever view that may be… in my case it is yetAnotherView, I suppose). The following command WON’T work — I guess because the view is hidden by the subviews:
UITouch *touch = [touches anyObject];
gestureStartPoint = [touch locationInView:self.view];
Is there a way to tell the compiler that it shouldn’t take self.view but whatever view is on top of all the other views?
Any help would be very much appreciated!
EDIT:
I think my problem is that the subviews I am editing are fullscreen UITextViews… and I guess I can override the touches on them? e.g. a swipe from right to left should work, but what about a swipe from bottom to top (that usually scrolls the uitextview — unless I set it to scrolling unabled).
If you use the touchesMoved:withEvent: method
Then you can use this:
Hope this helps.