- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个UIViewController
嵌入导航 Controller ,嵌入页面 View Controller 。在我的cellForRowAtIndexPath
,我得到2015-07-06 11:23:24.525 MyApp[3574:617281] *** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /SourceCache/UIKit/UIKit-3347.44.2/UITableView.m:6245
在var cell: CellOne =
.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let result: UITableViewCell
if (segmentedControl.selectedSegmentIndex == 0) {
// Getting error here...
var cell:CellOne = tableView.dequeueReusableCellWithIdentifier("CellOne", forIndexPath: indexPath) as! CellOne
cell.customLabel.text = array[indexPath.row]
result = cell
} else {
var cell = tableView.dequeueReusableCellWithIdentifier("CellTwo", forIndexPath: indexPath) as! CellTwo
cell.customLabelTwo.text = otherArray[indexPath.row]
result = cell
}
return result
}
最佳答案
您正在使用 Storyboard吗?如果没有的话,你是不是忘记注册手机了?
self.tableView.registerClass(CellOne.self, forCellReuseIdentifier: "CellOne")
self.tableView.registerClass(CellTwo.self, forCellReuseIdentifier: "CellTwo")
您可以将这些调用放在 viewDidLoad 上(这是一个安全的地方)。必须在调用tableViewDataSource协议(protocol)函数之前。
关于ios - [UITableView dequeueReusableCellWithIdentifier :forIndexPath:] 中的断言失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31253063/
我有一个使用 NSLayoutConstraints 的自定义/子类 UITableViewCell。最左边的 UIImageView 可能填充也可能不填充图像,如果没有,则此字段右侧的对象自然会向左
我知道 dequeueReusableCellWithIdentifier:forIndexPath 是由 tableviewcontroller 中的 tableView 方法调用的。如果我理解正确
所以我正在为我的学校制作一个 RSS 阅读器并完成代码。我运行了测试,它给了我这个错误。这是它引用的代码: - (UITableViewCell *)tableView:(UITableView *)
我在这里阅读了很多关于在不同问题中重用表格单元格的内容。 我实现了 UITableview 的子类(在 Swift 中) 在我的 ViewController 的 ViewDidLoad() 中注册了
所以我正在为我的学校制作一个 rss 阅读器并完成了代码。我运行了测试,它给了我这个错误。这是它所指的代码: - (UITableViewCell *)tableView:(UITableView *
我有一个UIViewController嵌入导航 Controller ,嵌入页面 View Controller 。在我的cellForRowAtIndexPath ,我得到2015-07-06 1
我不能像使用 UITableView 那样任意出列单元格来计算高度。使用 UICollectionView 执行此操作的等效方法是什么? dequeueResuableCellWithReuseIde
我想知道是否有人遇到过我最近试验过的类似问题。 让我进一步描述一下我的问题。我有一个 UITableViewController,我在 IB 中设计了一组自定义 UITableViewCell。每个
拥有一个UITableViewController并使用: override func tableView(tableView: UITableView, cellForRowAtIndexPat
我在尝试将 addSubView() 放入 UITableViewCell 时收到此错误消息 错误信息 2015-05-18 11:26:46.048 xxxxx[1128:437863] * Ass
我已阅读 this question并认为我理解这两种方法之间的区别,直到我找到一个奇怪的例子: 在Storyboard中设置table view cell的样式为Basic,Identifier为C
由于某种原因,我的应用程序在尝试将单元格加载到表格 View 时失败。我在整个应用程序中的所有表格 View 都完全相同,我对它们没有任何问题。这可能与从另一个 viewController 初始化
我是 xcode 的新手,我正在尝试使用自定义单元格在 tableview 中显示一些数据,但我得到了 *** Assertion failure in -[UITableView _configur
谁能告诉我为什么会出现此错误? 这是我的 .m 文件: #import "ListaParticipantesViewController.h" #import "Participantes.h" #
我在我的项目中使用tableview apple 的延迟加载代码,但在项目中出现异常。错误是 - *** Assertion failure in -[UITableView _configureCe
查看其他类似问题后,我不确定错误出在哪里。我收到了一个断言失败。 Terminating app due to uncaught exception 'NSInternalInconsistencyE
我在尝试填充我的表时遇到此错误: * Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath
这是我的 UITableView 代码。每当我加载 View 时,都会收到以下错误: *** Assertion failure in -[UITableView _configureCellForD
我在 tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCel
Apple 的文档中提到 indexPath 参数: The index path specifying the location of the cell. The data source recei
我是一名优秀的程序员,十分优秀!