运行代码时出现错误。错误全部在viewForHeaderInSection函数的下面一行中。
let header:friendsListSectionHeader = self.friendsTableView.dequeueReusableHeaderFooterViewWithIdentifier("friendsSection") as! friendsListSectionHeader
我在viewDidLoad中引用了它。
let nib2 = UINib(nibName: "friendsListSectionHeader", bundle: nil)
friendsTableView.registerNib(nib2, forCellReuseIdentifier: "friendsSection")
如果确实有任何作用,我确实有一个以上单元格的自定义视图。一切都建立了,但是我得到一个错误,当我解开Option值时意外发现nil。
我的.xib和UITableViewHeaderFooterView类都正确引用了。
有什么想法吗?
您只是使用了错误的注册方法,正在注册您应该使用的单元格 registerNib:forHeaderFooterViewReuseIdentifier:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句