开发者

iPhone TabBarController switching with selectedViewController doesn't show the view

开发者 https://www.devze.com 2023-01-04 07:28 出处:网络
I\'m getting crazy on this. I\'ve got a TabBarController with threw viewController and it\'s working ok in my app when I push the selection on the items.

I'm getting crazy on this.

I've got a TabBarController with threw viewController and it's working ok in my app when I push the selection on the items.

开发者_如何转开发

When I try to call self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:2]; (index 2 exists and the problem is with the index 1 too), I see the tabBarItem at position 2 selected (I mean the button) but the view will not appear (remaining at position 0 of the array item). I see that the viewController selected works in my debugger console but the view just doesn't appear.

Why it doesn't work? I've used it in previous apps and apparently there's nothing different.

Thanx for any suggestion you can provide.

Fabrizio


It was a time problem, I was calling the setSelectedViewController too early and it couldn't switch.

Fixed using this:

[self performSelector:@selector(yourMethod) withObject:nil afterDelay:0.1];

Fabrizio

0

精彩评论

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

关注公众号