如何从字符串文件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]
}
答案 0 :(得分:0)
正如github上的自述文件中所述,您需要将IndicatorInfoProvider
协议添加到子视图控制器。除此之外,需要将函数indicatorInfo
复制并粘贴到每个子类中。
结果将类似于:
class YourChildClass: YourViewController, IndicatorInfoProvider {
// ... Your code here ...
// MARK: - IndicatorInfoProvider
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
return IndicatorInfo(title: itemInfo)
}
}