【问题标题】:When i go from view back to tab bar controller, the tab bar doesnt show当我从视图返回标签栏控制器时,标签栏不显示
【发布时间】:2018-12-03 11:39:24
【问题描述】:

我将从一个标签栏控制器视图转到另一个不属于标签栏控制器的视图。什么时候,我尝试通过按后退按钮从视图返回到选项卡栏控制器视图,但选项卡栏不显示。该按钮的代码位于 back_golf 下。视图不在导航控制器中

import UIKit
import Firebase

class Golf: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableview_golf: UITableView!

var array = [String]()
var ref : DatabaseReference!
var handle: DatabaseHandle!

@IBAction func back_golf(_ sender: Any) {


let appDelegate = UIApplication.shared.delegate as! AppDelegate
let navigationController = appDelegate.window?.rootViewController as! 
UINavigationController

 navigationController.dismiss(animated: true, completion: nil)
  //self.navigationController?.popToRootViewController(animated: true)
 //self.performSegue(withIdentifier: "seque_golf", sender: nil)
 //hidesBottomBarWhenPushed = false
}
override func viewDidLoad() {
super.viewDidLoad()
ref = Database.database().reference()
handle = ref?.child("Girls_golf").observe(.childAdded, with: { 
(snapshot) in
    if let item = snapshot.value as? String {
        self.array.append(item)
        self.tableview_golf.reloadData()
    }

})


}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: 
Int) -> Int {
return array.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: 
IndexPath) -> UITableViewCell {
let cell = tableview_golf.dequeueReusableCell(withIdentifier: 
"golf_cell")! as UITableViewCell
cell.textLabel?.text = array[indexPath.row]
cell.textLabel?.numberOfLines = 0
return cell
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

【问题讨论】:

    标签: ios swift uibutton uitabbarcontroller


    【解决方案1】:

    您似乎已经跳过了 ViewControllers(在本例中为“Golf”)。如果这是真的,这应该适用于:

    @IBAction func back_golf(_ sender: Any) {
        self.dismiss(animated: true, completion: nil)
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-26
      • 1970-01-01
      • 2019-01-08
      • 1970-01-01
      • 2016-06-25
      • 2014-04-14
      相关资源
      最近更新 更多