We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在Swift中使用TYCyclePagerView,如果使用SnapKit库布局PageControl,会导致界面错乱,不调用layoutForPagerView方法,且视图查看会有多个Cell,具体代码如下:
let cycleView = TYCyclePagerView() cycleView.dataSource = self cycleView.isInfiniteLoop = true cycleView.autoScrollInterval = 3 cycleView.register(YoungHomePageCycleCell.self, forCellWithReuseIdentifier: "YoungHomePageCycleCell") view.addSubview(cycleView) cycleView.snp.makeConstraints { (make) in make.left.right.equalToSuperview() make.top.equalTo(view.safeAreaLayoutGuide) make.height.equalTo(cycleView.snp.width).multipliedBy(0.38) } let pageControl = TYPageControl() pageControl.numberOfPages = images.count pageControl.pageIndicatorTintColor = AppColor.basicColor pageControl.currentPageIndicatorTintColor = AppColor.themeColor pageControl.pageIndicatorSize = CGSize(width: 8, height: 8) pageControl.currentPageIndicatorSize = CGSize(width: 15, height: 8) cycleView.addSubview(pageControl) pageControl.snp.makeConstraints { (make) in make.centerX.bottom.equalToSuperview() make.size.equalTo(CGSize(width: 100, height: 20)) }
如果使用Frame布局pageControl就不存在该问题,且layoutForPagerView数据源方法正常调用,代码如下:
let cycleView = TYCyclePagerView() cycleView.dataSource = self cycleView.isInfiniteLoop = true cycleView.autoScrollInterval = 3 cycleView.register(YoungHomePageCycleCell.self, forCellWithReuseIdentifier: "YoungHomePageCycleCell") view.addSubview(cycleView) cycleView.snp.makeConstraints { (make) in make.left.right.equalToSuperview() make.top.equalTo(view.safeAreaLayoutGuide) make.height.equalTo(cycleView.snp.width).multipliedBy(0.38) } let pageControl = TYPageControl(frame: CGRect(x: 0, y: 0, width: 100, height: 20)) pageControl.numberOfPages = images.count pageControl.pageIndicatorTintColor = AppColor.basicColor pageControl.currentPageIndicatorTintColor = AppColor.themeColor pageControl.pageIndicatorSize = CGSize(width: 8, height: 8) pageControl.currentPageIndicatorSize = CGSize(width: 15, height: 8) cycleView.addSubview(pageControl)
The text was updated successfully, but these errors were encountered:
+1
Sorry, something went wrong.
No branches or pull requests
在Swift中使用TYCyclePagerView,如果使用SnapKit库布局PageControl,会导致界面错乱,不调用layoutForPagerView方法,且视图查看会有多个Cell,具体代码如下:
如果使用Frame布局pageControl就不存在该问题,且layoutForPagerView数据源方法正常调用,代码如下:
The text was updated successfully, but these errors were encountered: