IOS開發日記(四)—— 頁面跳轉問題

從一個UITabBarViewController跳轉到一個ViewController:

//添加手勢
myLabel.isUserInteractionEnabled=true
let myTapGes=UITapGestureRecognizer(target: self, action: #selector(self.labelClick(tapGes:)))
myLabel.addGestureRecognizer(myTapGes)
@objc private func labelClick(tapGes:UITapGestureRecognizer){
      self.tabBarController?.tabBar.isHidden=true
      self.navigationController?.pushViewController(MyViewController(), animated: true)
}

返回原頁面再顯示TabBar:

override func viewWillAppear(_ animated: Bool) {
      self.tabBarController?.tabBar.isHidden=false
}

參考:

https://www.cnblogs.com/bhlsheji/p/5168710.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章