0
私は、collectionview inside viewControllerです。私はViewControllerをに@IBOutletを追加した場合しかし、私はエラー取得:
「をUIPageControlへDetailViewControllerからpageControl出口が無効であるアウトレットは、コンテンツを繰り返すに接続することはできません。」
つまり、コンテンツを繰り返していますか?
私はこの質問が何度も尋ねられたことを理解していますが、私は示唆されたことを試みましたが何も助けませんでした。
class DetailViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UITableViewDelegate, UITableViewDataSource {
// MARK: - IBOutlet's
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var pageControl: UIPageControl!
var hallImages: Hall?
var currentPage = 0
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
tableView.estimatedRowHeight = 626
tableView.rowHeight = UITableViewAutomaticDimension
}
// MARK: - CollectionView
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
guard let imagesHall = hallImages?.ImagesHalls.count else {
return 0
}
return imagesHall
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! DetailCollectionViewCell
if let imagesHalls = hallImages?.ImagesHalls[indexPath.item] {
cell.imageView.sd_setImage(with: URL(string: imagesHalls))
}
return cell
}
}
私が追加することができますどのようにpageControllに:私のコードが必要な場合は、彼はここにある
... main.storyboardで
PageControlは一つだけ@IBOutletを持っており、それがエラーをスローしますcollectionViewまたはcollectionCell(私はどのように優れているかわかりません)?