TYPagerController icon indicating copy to clipboard operation
TYPagerController copied to clipboard

单独拿TYTabPageBar使用datasouce cellForItemAt方法不走

Open Maxcucurbit opened this issue 6 years ago • 1 comments

大神你好,求救,单独拿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
}

Maxcucurbit avatar May 23 '19 03:05 Maxcucurbit

reloadData 没

12207480 avatar May 24 '19 06:05 12207480