-1
マイページコントロールのUIが更新されていません。ページコントロール番号は毎回更新されていますが、ページコントロールUIでは更新されていません。私は多分updateCurrentPageDisplayを使用して、または私が行方不明だったが、私はちょうどエラーを受け取ったと思った。ここに私のコードです。 UIを更新するために必要なものがありませんか?マイページコントロールのUIが更新されていませんか?
@IBOutlet weak var pageControl: UIPageControl!
override func viewDidLoad() {
super.viewDidLoad()
collection.delegate = self
collection.dataSource = self
thisWidth = CGFloat(collection.frame.width)
pageControl.hidesForSinglePage = true
pageControl = UIPageControl.appearance()
pageControl.pageIndicatorTintColor = UIColor.lightGray
pageControl.currentPageIndicatorTintColor = UIColor.red
pageControl.numberOfPages = 10
pageControl.currentPage = 0
}
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 10
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! CalanderCollectionViewCell
let imagePath = array[indexPath.section]
cell.configureCell(properties: imagePath)
return cell
}
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
self.pageControl.currentPage = indexPath.section
print("current page\(pageControl.currentPage)")
pageControl.updateCurrentPageDisplay()
print(indexPath.section)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
thisWidth = CGFloat(collection.frame.width)
return CGSize(width: thisWidth, height: collection.frame.height)
}
コードの先頭部分が不完全と思われます。少なくとも1つの機能がありません。 –
あなたはコレクションビューについて話していますか?私はそうは思わない、どの機能が欠けている? –
'thisWidth'から' pageControl.currentPage = 0'はメソッドにラップされません。私はファイル内のどこに存在するのか分かりません。 –