UITabBarController only allows taps in leftmost 768px of child controllers.
| Originator: | percysnoodle | ||
| Number: | rdar://15867763 | Date Originated: | 21/1/14 |
| Status: | Duplicate of 15606466 (Open) | Resolved: | |
| Product: | iOS SDK | Product Version: | |
| Classification: | UI / Usability | Reproducible: | Always |
On the iPad, in landscape, the children of a tab bar controller can't be tapped on the right hand side of the screen. This seems to be because the child is wrapped in a UIViewControllerWrapperView which remains at 768x1024 instead of resizing, as in the following:
(lldb) po [[[[UIApplication sharedApplication] delegate] window] recursiveDescription]
<UIWindow: 0xc343110; frame = (0 0; 768 1024); gestureRecognizers = <NSArray: 0xc343650>; layer = <UIWindowLayer: 0xc343370>>
| <UILayoutContainerView: 0xc341160; frame = (0 0; 768 1024); transform = [0, -1, 1, 0, 0, 0]; autoresize = W+H; layer = <CALayer: 0xc341240>>
| | <UITransitionView: 0xc341af0; frame = (0 0; 1024 768); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0xc341bd0>>
| | | <UIViewControllerWrapperView: 0xc342c30; frame = (0 0; 768 1024); layer = <CALayer: 0xc342d00>>
| | | | <UIView: 0xc33b230; frame = (0 0; 1024 768); layer = <CALayer: 0xc33b290>>
| | | | | <UIButton: 0xc33bd60; frame = (880 44; 100 44); opaque = NO; autoresize = LM+BM; layer = <CALayer: 0xc33be50>>
| | | | | | <UIButtonLabel: 0xc33e1e0; frame = (25 13; 50 18); text = 'Tap me'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xc33e310>>
| | <UITabBar: 0xc341590; frame = (0 712; 1024 56); autoresize = W+TM; layer = <CALayer: 0xc3416b0>>
| | | <_UITabBarBackgroundView: 0x8c7ff90; frame = (0 0; 1024 56); autoresize = W; userInteractionEnabled = NO; layer = <CALayer: 0x8c80060>> - (null)
| | | | <_UIBackdropView: 0x8c47e90; frame = (0 0; 1024 56); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <_UIBackdropViewLayer: 0x8c81d10>>
| | | | | <_UIBackdropEffectView: 0x8c82570; frame = (0 0; 1024 56); clipsToBounds = YES; opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CABackdropLayer: 0x8c82840>>
| | | | | <UIView: 0x8c82fe0; frame = (0 0; 1024 56); hidden = YES; opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x8c83040>>
| | | <UITabBarButton: 0xc342220; frame = (474 1; 76 55); opaque = NO; layer = <CALayer: 0xc3427f0>>
| | | <UIImageView: 0x8c83d50; frame = (0 -1; 1024 1); autoresize = W; userInteractionEnabled = NO; layer = <CALayer: 0x8c83e60>> - (null)
Because the 1024x768 view is contained inside this 768x1024 wrapper view, only the left hand 768px are tappable.
Steps to reproduce:
1. Create a view controller inside a UITabBarController with a tappable target on the right hand side.
2. Rotate the device to landscape
3. Tap the target
Expected Results:
The target does not receive the tap.
Actual Results:
The target does not receive the tap.
Additional Notes:
The problem can be worked around by subclassing UITabBarController and overriding -viewDidLayoutSubviews:
- (void)viewDidLayoutSubviews
{
self.selectedViewController.view.superview.frame = self.view.bounds;
[super viewDidLayoutSubviews];
}
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!