UITabBarController setSelectedViewController:只能选择标签栏控制器的视图控制器列表中的视图控制器

编程入门 行业动态 更新时间:2024-10-28 11:28:31
本文介绍了UITabBarController setSelectedViewController:只能选择标签栏控制器的视图控制器列表中的视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我在这行的 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-24 12:22:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1063921.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制器   视图   标签   列表中   UITabBarController

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!