简体   繁体   中英

Type 'Custom TableViewController' does not conform to protocol 'UICollectionViewDataSource'

Type 'Custom TableViewController' does not conform to protocol 'UICollectionViewDataSource'.

I have created a project using Swift and have a UITableViewcontroller. and in UITableFooterView i added collection but i can't add UICollectionViewDataSource.

Type 'TableViewController' does not conform to protocol 'UICollectionViewDataSource'

Check once your datasource method is delecared or not

func collectionView(collectionView: UICollectionView, numberOfItemInSection section: Int) -> Int;

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell;

if it is already declared , Check for types in your code Like - use numberOfItemsInSection instead numberOfItemInSection .

It should work if you have implemented the following methods

- collectionView:numberOfItemsInSection:
- collectionView:cellForItemAtIndexPath:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM