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

isthisonetaken

macrumors regular
Original poster
Jun 29, 2006
123
0
Hey All,

so I have an app that has some gesture recognizers in it. From doing some testing, I have a weird problem. In my view controller heirarchy, I have many views with an imageView at the very bottom (so ontop of everything else). I'm adding a tap gesture recognizer to that imageView (and user interaction is enabled for it). I have 2 second views underneath which take up about 2/3 of the iPad screen in landscape mode (no rotation in the app). If I tap to the left of the views or inbetween, all works well. However, if I tap to the right of the second view (so in the right 1/3 of the screen) nothing happens... I added in code to the gesture recognizer, so that when it is called, it creates a green view with the same frame as the view the gesture recognizer is attached to (which should be the entire screen) and adds it, so I can make sure the gesture recognizer is on the whole screen. This works, so when I tap on the left 2/3 of the screen, everything works fine, but that right 1/3 it doesn't trigger the recognizer.

Some more backstory to the app: The view controller which does all this is a child view controller which is loaded from a storyboard. From trying things out in testing, if I set the auto resizing mask for the view to have a flexible width, it actually shows up in just the 2/3 of the screen in the parent view controller... Even if I explicitly set the size of the view to be the entire screen, it will still show up that way when flexible width is enabled...

EDIT:
Upon further testing, I added in this method
Code:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    DLog(@"touches = %@", touches);
    DLog(@"event = %@", event);
}

Just to see if touches were being registered...They aren't in the right 1/3 of the screen. However, I know it's not something wrong with the iPad, as the touches are registered in other apps, just my app, in this one child view controller.
Any ideas guys?

I fixed the problem. It was that after initializing the view controller from my storyboard, I was simply setting it's view into my self.view. However, I wanted it to fit into a specific frame (which I was setting for the child view controller). I fixed it by creating a view with the frame I wanted to use for the child and setting the child into it! Silly mistake...
 
Last edited:
If I had to guess why you don't have a response yet, I'd say it's because it's too difficult to follow your problem description.

I think uploading the relevant portion of your project, or at least a screenshot of your view layout, along with all the relevant code, would probably help us a good deal with figuring your problem out.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.