gpt4 book ai didi

ios - 导航和选项卡 View Controller 未正确加载,然后跳转到位

转载 作者:行者123 更新时间:2023-11-28 06:29:01 26 4
gpt4 key购买 nike

当我尝试显示 TabViewController 时,我的 TabBar 和 NavigationBar 都出现了奇怪的行为,如下图所示。在我触摸屏幕或按下按钮之前,它一直保持在“之前”图像中显示的状态。此时它跳转到“之后”图像。

之前:enter image description here之后:

enter image description here

用于呈现 TabViewController 的代码:

let delegate = UIApplication.shared.delegate as! AppDelegate
delegate.tabViewController = TabViewController()
self.present(delegate.tabViewController!, animated: true, completion: nil)

TabViewController 的初始化:

override func viewDidLoad() {
super.viewDidLoad()

let groupTable = GroupTableViewController()
let nav = UINavigationController(rootViewController: groupTable)
nav.title = "Groups"
nav.tabBarItem.image = UIImage(named: "groups")

let vc2 = MeViewController()
vc2.title = "Me"
vc2.tabBarItem.image = UIImage(named: "user")
// let vc3 = SettingsViewController
// vc3.title = "Settings"
// vc3.tabBarItem.image = UIImage(named: "settings")

self.viewControllers = [nav, vc2]
self.selectedIndex = 0
}

控制台日志,但我认为错误不相关:

objc[63765]: Class PLBuildVersion is implemented in both /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x11916f998) and /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x118069d38).
One of the two will be used. Which one is undefined.

这是我在更新到 Xcode 8.1/MacOS Sierra 后似乎遇到的一个新错误。

我的 XCode 版本是 Version 8.1 beta (8T47)。这可能是测试版中的错误吗?

我不确定是什么原因造成的,因为在这种情况开始发生时我没有更改代码。

感谢您的帮助。

最佳答案

选项卡 View Controller 的 viewDidLoad 真的来不及配置选项卡 View Controller 及其两个 subview Controller 。要么在“用于呈现 TabViewController 的代码”中执行此操作,要么,如果您真的想从选项卡 View Controller 本身中执行此操作,请从选项卡 View Controller 的初始化程序中执行此操作。那么一切都会好起来的。

关于ios - 导航和选项卡 View Controller 未正确加载,然后跳转到位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40944076/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com