0

我使用的UITabBarController与UINavigationControllers这样的UITabBarController没有响应

enter image description here

我添加此使用

tabctrl.view.frame = CGRectMake(0, 0, 320, 548); 
[self.view addSubview:tabctrl.view]; 

视图中的屏幕看起来像

enter image description here

但我不能切换到其他选项卡。如果我改变像

tabctrl.view.frame = CGRectMake(0, 0, 320, 488); 

然后屏幕看起来像帧(即,触摸标签ctrl的标签上没有响应)

enter image description here

现在,我可以触摸该选项卡并切换到所需的视图控制器。如何解决这个问题?

我需要访问标签ctrl当它的框架高度为568

我使用的Xcode 4.6.2和iOS模拟器4英寸视网膜。

+0

请问你清楚它第一次[self.view addSubview:tabctrl.view]。这里是什么self.view? –

+0

自我。 view,view是一个UIViewcontroller – NAZIK

+0

那么它在哪里(UIViewcontroller)被添加到窗口上? –

回答

1

您的tabbar控制器可能位于屏幕底部的其他位置。你可以用代码测试:

[self.view bringSubviewToFront: tabctrl] 

如果这能解决你的问题,试图找到的图,是在你的TabBar控制器

2

使用此代码的前面:

[appDelegate.window setRootViewController:tabctrl]; 

,而不是:

tabctrl.view.frame = CGRectMake(0, 0, 320, 568); 
[self.view addSubview:tabctrl.view]; 
1

将你的rootViewController的wantsFullScreenLayout属性设置为YES

tabbarController.wantsFullScreenLayout = YES 

这应该解决4英寸的屏幕上你的TabBar切换问题