iOS5设备上的黑色TabBar [英] Black TabBar on iOS5 device
问题描述
如果我在iOS5下运行我的应用程序似乎都很好。但是如果我尝试使用TabBar加载视图并在其中加入一些视图。
if I run my app under iOS5 all seems to be fine. But if I try to load a view with a TabBar and some views in it.
屏幕看起来就像下图所示,所以黑色标签栏和第一个子视图应该在屏幕上的标签栏已取消分配。我假设,视图和标签栏之间的绑定不存在。
The screen looks actually like the picture below, so a black tabbar and the first subview of the tabbar which should be onscreen is deallocated. I assume, that the binding between the view and the tabbar does not exist.
所以我认为我有办法将视图与标签栏链接起来。
So I think it has something to do how I link the views with the tabbar.
它的工作原理如下:
NSMutableArray* controllersForHome = [[self.tabBarController.viewControllers mutableCopy] autorelease];
[controllersForHome insertObject:somveViewController atIndex:[controllersForHome count]];
[self.tabBarController setViewControllers:controllersForHome];
[someViewController release];
我读过在索引> 0时插入对象应该会有所帮助,但不幸的是没有我的情况。仍然是同样的问题。
I've read that inserting the object at an index >0 should be helpful, but unfortunately not in my case. Still the same issue.
有人猜测并且可以给我一个如何解决这个问题的提示吗?
Has somebody a guess and can give me a hint how to solve that problem?
谢谢,
Andreas
推荐答案
这就是我在iOS中解决问题的方法5:
this is how I solved the problem in iOS 5:
而不是使用它:
SMutableArray* controllersForHome = [[self.tabBarController.viewControllers mutableCopy] autorelease];
[controllersForHome insertObject:someViewController atIndex:[controllersForHome count]];
[self.tabBarController setViewControllers:controllersForHome];
[someViewController release];
你应该使用这个:
self.tabBarController.viewControllers = [[NSArray arrayWithArray:self.tabBarController.viewControllers] arrayByAddingObject:someViewController];
这篇关于iOS5设备上的黑色TabBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!