UITabBarController setSelectedViewController:只能选择标签栏控制器的视图控制器列表中的视图控制器 [英] UITabBarController setSelectedViewController: only a view controller in the tab bar controller's list of view controllers can be selected

查看:44
本文介绍了UITabBarController setSelectedViewController:只能选择标签栏控制器的视图控制器列表中的视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这行的 xcode 6 版本中崩溃了

I am getting crash in xcode 6 version at this line

 -[UITabBarController setSelectedViewController:]
'NSInvalidArgumentException', reason: '-[UITabBarController setSelectedViewController:] only a view controller in the tab bar controller's list of view controllers can be selected.'

它在 xcode 5 中正常工作.self.selectedIndex 给出了垃圾值.

Its working properly in xcode 5. The self.selectedIndex is giving garbage value.

有没有人知道如何解决这个问题.代码最初是用 xcode 4.0 编写的

Does anyone have an idea how to solve this. The code is originally written in xcode 4.0

谢谢

推荐答案

如果您制作了自定义选项卡栏,则移除您正在传递的视图控制器数组的合成.这对我有用.

If you have made custom tab bar then remove the synthesis of the array of view controllers you are passing. That worked for me.

这篇关于UITabBarController setSelectedViewController:只能选择标签栏控制器的视图控制器列表中的视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆