开发者

UITabBarController unresponsive for touches

开发者 https://www.devze.com 2023-02-02 15:21 出处:网络
So, I have this view hierarchy in my app: UIWindow UIViewController UITabBarController -> 4 UINavigationController

So, I have this view hierarchy in my app:

UIWindow
UIViewController
UITabBarController -> 4 UINavigationController

I know that a UITabBarController is designed to be the topmost view in an app, however this isn't possible in my case. However, the problem that I have is that ~20 of the lower pixels aren't responsive for touches so that the UITabBarController doesn't trigger the tab changes correctly. This happens on an actual device (iPad and iPhone 3G).

My question is, are there any obvious reasons why this could happen? I add the UITabBarController like this as subvie开发者_运维技巧w to my UIViewController view:

- (void)viewDidLoad 
{
    [super viewDidLoad];
    [self.view addSubview:controller.view]; // Controller is the UITabBarController
}

I didn't set the UITabBarController's delegate.


UITabBarController should never be embedded in a UIViewController because, as it descends from UIViewController, it already is one; just with extra flair. Currently the root UIViewController is intercepting all of your touch events.

Make the UITabBarController's view the subview of your UIWindow in the app delegate.

0

精彩评论

暂无评论...
验证码 换一张
取 消