Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Maxcucurbit opened this issue May 23, 2019 · 1 comment
Open

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

Maxcucurbit opened this issue May 23, 2019 · 1 comment

Comments

@Maxcucurbit
Copy link

大神你好,求救,单独拿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
}
@12207480
Copy link
Owner

12207480 commented May 24, 2019

reloadData 没

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants