0
類
我想要的PageControl添加到我的收藏查看這是我的CollectionView細胞裏面,所以我需要聲明UIPageControl所以如何聲明UIPageControl內
let CollectionViewPageControl: UIPageControl = {
let pageControl = UIPageControl()
pageControl.frame = CGRect(x: 0, y: 100, width: 10, height: 10)
pageControl.currentPage = 0
pageControl.currentPageIndicatorTintColor = UIColor.red
pageControl.pageIndicatorTintColor = UIColor.lightGray
return pageControl
}
,但我得到這個錯誤Cannot convert value of type '() -> _' to specified type 'UIPageControl'
有幫助嗎?
不要忘記'self.addSubview(collectionViewPageControl)'。 –
當然,我只是推斷OP在UIPageControl的聲明上只有問題,因爲這是他發佈的唯一代碼。但我會編輯答案:) –