iPad landscape-only app not responding to touches near the bottom of the screen
I’m an experienced developer, but relatively new to iOS.
I’m having some trouble with an开发者_开发技巧 iPad App, where my views are not responding to button touches in the bottom third of the screen. Touches on other buttons are working fine, so I know my views are getting hooked up properly when they’re loaded (I’ve created them in IB.) I get the same behavior on both the simulator and the device.
This is a landscape-orientation-only App, and I’m loading views using [NSBundle LoadNibNamed:]. This was the only non-trivial portion of the App, and I think I’ve jumped through all the appropriate hoops:
- Added Initial Interface Orientation line to my .plist
- Designed my views in Landscape orientation in IB
- Added shouldAutoRotateToInterfaceOrientation to my top-level view that only return YES for landscape orientations
The landscape orientation may not be related, but I thought I should mention it, since it was the only thing I found a little wonky to build, and I see from the boards that other people have found this problematic as well..
Does anyone have any ideas?
Thanks.
More than likely, your autoresizing masks are not set correctly. This means that the view's bounds are not changing to match the window. Touches are only detected within the bounds of a view's super view, so if you have a button that sits outside its superview's bounds, it won't get any touches.
For a quick test, try setting your view's background color and see if the view does properly extend to the bottom of the screen.
It turns out my view's bounds were set to the full screen, but the frame was not. By explicitly setting the frame, I was able to get this working.
If your apps, on your app screen, will not respond to touch, just change the orientation. I kept it in landscape mode most of the time, they stopped responding, when I rotated the ipad they started responding right away.
精彩评论