标签栏在从饼图中跳出故事板后消失

时间:2018-04-02 19:19:51

标签: swift uitabbarcontroller uitabbar uistoryboardsegue

enter image description here

嗨,我在pieChart切片中遇到了一个segue的问题,segue正常工作,但其标签栏控制器消失了。如果我使用故事板上的按钮转到同一ViewController,标签栏会正常显示。

Here is my code:



func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) {

    guard let sliceType = entry.data as? SliceType else {
        return
    }

    switch sliceType {
    case .electricity:

        let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
        let addEleController = storyboard.instantiateViewController(withIdentifier: "electricity")
        self.navigationController?.pushViewController(addEleController, animated: true)

    case .gas:
        let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
        let addEleController = storyboard.instantiateViewController(withIdentifier: "gas")
        self.navigationController?.pushViewController(addEleController, animated: true)
    case .water:
        let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
        let addEleController = storyboard.instantiateViewController(withIdentifier: "water")
        self.navigationController?.pushViewController(addEleController, animated: true)
    case .phone:
        let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
        let addEleController = storyboard.instantiateViewController(withIdentifier: "phone")
        self.navigationController?.pushViewController(addEleController, animated: true)
    case .paytv:
        let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
        let addEleController = storyboard.instantiateViewController(withIdentifier: "paytv")
        self.navigationController?.pushViewController(addEleController, animated: true)
        addEleController.isKind(of: TabBarController.self)
    }

}

0 个答案:

没有答案