MQZHot / ZCycleView

使用UICollectionView实现常见图片无限轮播,支持自定义cell,自定义pageControl,以及轮播样式
MIT License
437 stars 69 forks source link

reloadItemsCount在初始化时不使用的话--->会导致不触发自动轮播 #35

Open yeahohooh opened 3 years ago

yeahohooh commented 3 years ago

如果在初始化的时候不调用reloadItemsCount,会导致不自动轮播。 比如我是在网络请求后使用的reloadItemsCount

mizhousoft commented 3 years ago

+1

mizhousoft commented 3 years ago

public func reloadItemsCount(_ count: Int) { cancelTimer() if isAutomatic { startTimer() } realItemsCount = count placeholder.isHidden = realItemsCount != 0 setItemsCount() dealFirstPage() pageControl.numberOfPages = realItemsCount pageControl.currentPage = getCurrentIndex() % realItemsCount }

应该把 if isAutomatic { startTimer() } 这代码放到最后去,根据最新的 itemCount 来开启

blockshark commented 3 years ago

居然还要这么多Star

Mr-ZNN commented 2 years ago

+1