0

如何从字符串文件 xlpagertabstrip 子标题中设置 itemInfo 文本

 override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
            **let path = Bundle.main.path(forResource: "String" , ofType: "plist")
            let dict = NSDictionary(contentsOfFile: path!)
            let Data = dict?.object(forKey: "Main_Menu_Title") as! [String]
            let child_1 = HomeViewController(itemInfo: Data[0] )**
            let child_2 = SectraitViewController(itemInfo: "Home")
            let child_3 = InfrastructureViewController(itemInfo: "Home")
            let child_4 = TourismViewController(itemInfo: "Home")
            let child_5 = HomeViewController(itemInfo: "Home")

            guard isReload else {
                return [child_1, child_2, child_3, child_4, child_5]
            }
4

1 回答 1

0

如github上的自述文件中所述,您需要将IndicatorInfoProvider协议添加到您的子视图控制器。除此之外,还需要将该函数复制并粘贴indicatorInfo到每个子类中。

结果将类似于:

class YourChildClass: YourViewController, IndicatorInfoProvider {

  // ... Your code here ...

  // MARK: - IndicatorInfoProvider

  func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
    return IndicatorInfo(title: itemInfo)
  }
}
于 2018-05-16T09:29:08.547 回答