所以我有这个故事板。离开导航控制器,并返回到标签栏视图
这是当您单击保存按钮的代码。
@IBAction func addGroupAction(_ sender: Any) {
self.name = groupNameTextField.text!
//show spinner progress dialog
self.hud.textLabel.text = "Loading..."
self.hud.show(in: self.view)
DispatchQueue.global(qos: .background).async {
if !self.uuid.isEmpty {
self.service.groupCreate(uuid: self.uuid, name: self.name, type: "regular", callback: {
status, message, json in
DispatchQueue.main.async {
print(status)
print(message)
print(json)
}
self.hud.dismiss()
//this block of code does not work
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "MainTabbar") as! UITabBarController
self.present(controller, animated: true, completion: {() -> Void in })
})
} else {
print("no uuid")
}
}
}
我想摆脱创建组视图控制器并返回到选项卡栏控制器。执行segue作品,但会显示一个“Back”导航项目栏按钮。
您的图像不可见。 Tab Bar Controller是默认的UITabBarController还是一些自定义控制器? – Mehul
是的这是一个默认的TabBarController –
得到你想要去任何控制器的实例。然后将其设置为根视图控制器..多数民众赞成它! – CaffeineShots