【发布时间】:2018-10-09 11:37:30
【问题描述】:
我尝试使用 Xib 文件实现 Section Header。我创建了一个 Xib 视图并参加 UITableViewHeaderFooterView 到这个视图。当我运行 App 时,它给了我没有任何描述的错误。问题出在哪里?
提前致谢。
tableView.register(UINib(nibName: "EventViewCell", bundle: nil), forCellReuseIdentifier: "EventViewCell")
tableView.register(UINib(nibName: "EventCellSectionHeader", bundle: nil), forHeaderFooterViewReuseIdentifier: "EventCellSectionHeader")
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let cell = tableView.dequeueReusableHeaderFooterView(withIdentifier: "EventCellSectionHeader") as! EventCellSectionHeader
cell.headerName.text = "aa"
return cell
}
class EventCellSectionHeader: UITableViewHeaderFooterView {
@IBOutlet var headerName: UILabel!
}
libc++abi.dylib:以 NSException 类型的未捕获异常终止
【问题讨论】:
-
你能分享完整的错误信息吗?应该比你给的更多。从
Terminating with uncaught exception of type NSUncaughtException(注意“Terminating”+“NSUncaughtException”与“NSException”处的大写)到你给的那个。 -
就是这样。只需编写 libc++abi.dylib: terminating with NSException 类型的未捕获异常并重定向到 AppDelegate 文件
-
在情节提要中检查 EventCellSectionHeader 单元格的标识符名称。
-
我使用 xib。随便写标识符名的地方
标签: swift uitableview xib