简体   繁体   English

类型“自定义TableViewController”不符合协议“ UICollectionViewDataSource”

[英]Type 'Custom TableViewController' does not conform to protocol 'UICollectionViewDataSource'

Type 'Custom TableViewController' does not conform to protocol 'UICollectionViewDataSource'. 类型“自定义TableViewController”不符合协议“ UICollectionViewDataSource”。

I have created a project using Swift and have a UITableViewcontroller. 我已经使用Swift创建了一个项目,并拥有一个UITableViewcontroller。 and in UITableFooterView i added collection but i can't add UICollectionViewDataSource. 在UITableFooterView中,我添加了集合,但无法添加UICollectionViewDataSource。

Type 'TableViewController' does not conform to protocol 'UICollectionViewDataSource' 类型“ TableViewController”不符合协议“ 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 . 如果已经声明,则在代码中检查类型,例如,使用numberOfItemsInSection代替numberOfItemInSection

It should work if you have implemented the following methods 如果您实现了以下方法,它应该可以工作

- collectionView:numberOfItemsInSection:
- collectionView:cellForItemAtIndexPath:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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