Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift:对CustomTab重复使用一个ViewController_Ios_Swift_Uitableview_Uiviewcontroller_Uitabbarcontroller - Fatal编程技术网

Ios Swift:对CustomTab重复使用一个ViewController

Ios Swift:对CustomTab重复使用一个ViewController,ios,swift,uitableview,uiviewcontroller,uitabbarcontroller,Ios,Swift,Uitableview,Uiviewcontroller,Uitabbarcontroller,我需要帮助,我有在viewController之间切换的library call CarbonKit,它的行为与Android上的选项卡相同,我现在的问题是,要使用的选项卡或viewController的数量是动态的,可以是两个、三个或四个,viewController中只有一个tableView,如何创建一个viewController并将其重新用于所有选项卡。 这就是我需要使用逻辑的地方 lazy var firstChildTabVC: UIViewController? = {

我需要帮助,我有在viewController之间切换的library call CarbonKit,它的行为与Android上的选项卡相同,我现在的问题是,要使用的选项卡或viewController的数量是动态的,可以是两个、三个或四个,viewController中只有一个tableView,如何创建一个viewController并将其重新用于所有选项卡。 这就是我需要使用逻辑的地方

lazy var firstChildTabVC: UIViewController? = {
    let firstChildTabVC = self.storyboard?.instantiateViewController(withIdentifier: "RecentVC")
    return firstChildTabVC
}()
lazy var secondChildTabVC: UIViewController? = {
    let secondChildTabVC = self.storyboard?.instantiateViewController(withIdentifier: "RecentVC")
    return secondChildTabVC
}()
lazy var thirdChildTabVC : UIViewController? = {
    let thirdChildTabVC = self.storyboard?.instantiateViewController(withIdentifier: "RecentVC")
    return thirdChildTabVC
}()

extension TrendVC: CarbonTabSwipeNavigationDelegate{

    func carbonTabSwipeNavigation(_ carbonTabSwipeNavigation: CarbonTabSwipeNavigation, viewControllerAt index: UInt) -> UIViewController {
    var vc: UIViewController?
    switch index {
    case TabIndex.firstChildTab.rawValue :
        vc = firstChildTabVC
    case TabIndex.secondChildTab.rawValue :
        vc = secondChildTabVC
    case TabIndex.thirdChildTab.rawValue :
        vc = thirdChildTabVC
    default:
        return UIViewController()
    }

    return vc!
   }
}

您可以创建任意多个选项卡。 但想想iphone 5、6或7用户。如果您的标签号超过5,他们如何点击您的标签


我认为这比告诉您创建多个选项卡的解决方案更重要。

实际上,我正在创建的选项卡与Android上的选项卡类似,它不是底部选项卡。iOS中没有任何功能。你需要定制一下,伙计(我编辑了我的问题,以显示我正在尝试做什么。