我正在做Let的内置应用程序的Twitter重拍教程,我不断遇到这个错误:'无法出现类型的视图:带标识符headerId的UICollectionElementKindSectionFooter - 必须为标识符注册一个nib或类或连接原型故事板中的单元格'。我尝试注册下面的标题,但我的应用程序仍然给我同样的错误。这是视频的链接: https://www.youtube.com/watch?v=2fcf9yFe944&list=PL0dzCUj1L5JE1wErjzEyVqlvx92VN3DL5
Vagrant.configure("2") do |config|
config.vm.box = "debian/jessie64"
config.vm.network "private_network", ip: "192.168.56.101"
config.vm.synced_folder "../mysite.local", "/code/mysite.local", type: "virtualbox"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
end
答案 0 :(得分:0)
您已将该视图注册为UICollectionElementKindSectionHeader
,但正尝试将其用作UICollectionElementKindSectionFooter
。这些细节是关键。
您可以通过执行以下操作来检查以确保collectionView
方法获得正确的类型:
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
if kind == UICollectionElementKindSectionHeader {
//Now you can dequeue your view with reuseId "headerId"
} else {
//This is where you set the footerView, if you are using one
}