Open Maxcucurbit opened 5 years ago
大神你好,求救,单独拿TYTabPageBar使用,为什么datasouce里的pagerTabBar(_ pagerTabBar: TYTabPagerBar, cellForItemAt index: Int) -> UICollectionViewCell & TYTabPagerBarCellProtocol 不走啊,只走了numberOfItemsInPagerTabBar,请问怎么回事 private let barTitles = ["xx", "xx", "xx"] private let pagerBar = TYTabPagerBar().then { $0.layout.barStyle = .progressBounceView $0.layout.cellWidth = Metric.cellWidth $0.layout.progressColor = Metric.pagerBarFontColorS $0.layout.progressWidth = Metric.progressWidth $0.layout.normalTextColor = Metric.pagerBarFontColorN $0.layout.selectedTextColor = Metric.pagerBarFontColorS $0.layout.progressHeight = Metric.progressHeight $0.backgroundColor = .white $0.layout.cellSpacing = 0 $0.layout.cellEdging = 0 $0.layout.normalTextFont = Metric.pagerBarFontSize $0.layout.selectedTextFont = Metric.pagerBarFontSize $0.height = Metric.pagerBarHeight $0.register(TYTabPagerBarCell.self, forCellWithReuseIdentifier: "TYTabPagerBarCell") }
override func viewDidLoad() { super.viewDidLoad() pagerBar.delegate = self pagerBar.dataSource = self navigationItem.titleView = pagerBar }
func numberOfItemsInPagerTabBar() -> Int { return 3 } func pagerTabBar(_ pagerTabBar: TYTabPagerBar, cellForItemAt index: Int) -> UICollectionViewCell & TYTabPagerBarCellProtocol { let cell = TYTabPagerBarCell.init() cell.titleLabel?.text = barTitles[index] return cell }
reloadData 没
大神你好,求救,单独拿TYTabPageBar使用,为什么datasouce里的pagerTabBar(_ pagerTabBar: TYTabPagerBar, cellForItemAt index: Int) -> UICollectionViewCell & TYTabPagerBarCellProtocol 不走啊,只走了numberOfItemsInPagerTabBar,请问怎么回事 private let barTitles = ["xx", "xx", "xx"] private let pagerBar = TYTabPagerBar().then { $0.layout.barStyle = .progressBounceView $0.layout.cellWidth = Metric.cellWidth $0.layout.progressColor = Metric.pagerBarFontColorS $0.layout.progressWidth = Metric.progressWidth $0.layout.normalTextColor = Metric.pagerBarFontColorN $0.layout.selectedTextColor = Metric.pagerBarFontColorS $0.layout.progressHeight = Metric.progressHeight $0.backgroundColor = .white $0.layout.cellSpacing = 0 $0.layout.cellEdging = 0 $0.layout.normalTextFont = Metric.pagerBarFontSize $0.layout.selectedTextFont = Metric.pagerBarFontSize $0.height = Metric.pagerBarHeight $0.register(TYTabPagerBarCell.self, forCellWithReuseIdentifier: "TYTabPagerBarCell") }
override func viewDidLoad() { super.viewDidLoad() pagerBar.delegate = self pagerBar.dataSource = self navigationItem.titleView = pagerBar }