UIButtons work when rotated right, but not when rotated left. Huh?
I have a view that is added to the current view when the device is rotated to a LandscapeLeft or LandscapeRight orientation. This view has 4 buttons on it that are all connected to outlets and each have the "touch up inside" event hooked up to the same action. If rotated to a LandscapeLeft orientation, I transform my added view to rotate -90 degrees, and everything works fine. If rotated to a LandscapeRight orientatio开发者_高级运维n, I transform the added view to rotate 90 degrees, and the buttons don't work! Highlighting doesn't happen, and the action isn't called.
I am at a bit of a loss as to why this might be. Any ideas?
Verify that the coordinates of the buttons (after rotation) are still within the coordinates of the parent view. They may appear on the screen in the right place and be visible but I think that if the buttons are outside of their parent view's boundaries then touches won't be passed down to them (see hitTest:withEvent:).
You can use dumpView() on the button's parent view to get a NSLog of their frames.
精彩评论