我有一个带有 tabbarcontroller 的 Storyboard。其中一个选项卡栏有一个表格 View ,我希望当用户从表格 View 中点击一行时,打开一个带有另一个选项卡栏的详细 View 。 问题是当我打开详细 View 标签栏时隐藏。如何在 didselectrowatindexpath 中显示标签栏?
didselectrowatindexpath中的代码:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let storybaord=UIStoryboard(name: "Main", bundle: nil)
let DVC=storybaord.instantiateViewController(withIdentifier: "NewsViewController") as! NewsViewController
DVC.getImage=sneaker[indexPath.row]
DVC.getNews=News[indexPath.row]
self.navigationController?.pushViewController(DVC, animated: true)
}
我已经创建了单 View 应用程序。我已经创建了 DiscoveryNewsTableViewCell。我用两个数组 1-运动鞋 2- 新闻数组填充了表格 View 单元格。我想要特定的数组显示栏 Controller 的 ist 选项卡。但我确实得到了这些标签栏 Controller 第一个选项卡上的字段。这是此 https://drive.google.com/file/d/1uSYl-4a1UQXpMXkSQ_l8aij6EH_v2yna/view?usp=sharing 的示例代码
最佳答案
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// setting these values in local storage using user defaults
let currentObj = News[indexPath.row]
UserDefaults.standard.set(currentObj, forKey: "currentOb")
let storybaord=UIStoryboard(name: "Main", bundle: nil)
let DVC=storybaord.instantiateViewController(withIdentifier: "NewsViewController") as! NewsViewController
self.navigationController?.pushViewController(DVC, animated: true)
}
关于ios - 如何快速从 Storyboard中的 didSelectRowAt indexPath 打开 View 选项卡 Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47919254/