我还没有能够将Nib上传到我的表格视图,这个问题与我正在处理的其他应用程序发生时一样,尽管我确实有一些NIb文件可以正常工作。我甚至重新安装Xcode试图解决这个问题。我登记我的笔尖如下无法在包中加载Nib
let test = "test"
let cellNib = UINib(nibName: test, bundle: nil)
tableView.register(cellNib, forCellReuseIdentifier: test)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: test, for:indexPath) as! testCell //after this function is called I get a crash
return cell
}
这是消息我从碰撞获得的一部分,我不知道是否有用。
'NSInternalInconsistencyException',原因: '在束无法加载NIB: '一个NSBundle(加载)' 名为 '测试'' ***第一掷调用堆栈: ( 0的CoreFoundation 0x000000010afdab0b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x0000000107b98141 objc_exception_throw + 48 2的CoreFoundation 0x000000010b043625 + [NSException提高:格式:] + 197 3的UIKit 0x0000000108b59b24 - [UINib instantiateWithOwner:选择:] + 501 4的UIKit 0x00000001088ac567 - [UITableView的_dequeueReusableViewOfType:withIdentifier:] + 402 5 UIKit 0x00000001088aca4b - [UITableView dequeueReusableCellWithIdentifier :forIndexPath:] + 71 6 Chaol 0x000000010759ebe9 _TFC5Chaol23QuestionsViewController9tableViewfTCSo11UITableView12cellForRowAtV10Foundation9IndexPath_CSo15UITableViewCell + 153
我的.xib文件出现在拷贝束资源。
我绝对试过这样,它没有工作。我现在已经编程创建了一切。 –