gpt4 book ai didi

ios - 如何将屏幕从一个 TabBarItem 传递到另一个 TabBarItem?

转载 作者:搜寻专家 更新时间:2023-11-01 07:08:52 27 4
gpt4 key购买 nike

enter image description here

在上图中,

在Tabbar中选中1. tabbar itemA -> C -> D并且比

在Tabbar中选中 3. tabbar item按照顺序E -> D -> A

App 会记住 1. tabbar item 上的 D 屏幕。我想要打开“A”屏幕。

下面的代码;

D View Controller :

   @IBAction func goToMapButton(_ sender: Any) {

if let navController = self.tabBarController?.viewControllers?[0] as? UINavigationController{
if let mapController = navController.childViewControllers.first as? MapViewController{
self.tabBarController?.selectedIndex = 0
mapController.zoomToGeo(X: Double(PhotoItemArraySelected[0].photoLon!)!, Y: Double(PhotoItemArraySelected[0].photoLat!)!,TesisAdi: PhotoItemArraySelected[0].photoName)

}
}

dismiss(animated: true, completion: nil)
}

最佳答案

如果要显示属于选项卡1的屏幕A,并且屏幕A看起来是MapViewController:

if let navController = self.tabBarController?.viewControllers?[0] as? UINavigationController{
if let mapController = navController.childViewControllers.first as? MapViewController{
self.tabBarController?.selectedIndex = 0
mapController.zoomToGeo(X: Double(PhotoItemArraySelected[0].photoLon!)!, Y: Double(PhotoItemArraySelected[0].photoLat!)!,TesisAdi: PhotoItemArraySelected[0].photoName)

//add this line and to check if it works good or not.
navController.popToViewController(mapController, animated: true)
}
}

关于ios - 如何将屏幕从一个 TabBarItem 传递到另一个 TabBarItem?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46174939/

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