- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
使用 iOS6 和 Storyboard,我有一个包含 3 个部分的 UITableViewController。
前两部分是静态的,第三部分是动态的。
我已经重写了 numberOfRowsInSection
、cellForRowAtIndexPath
和 heightForRowAtIndexPath
以正确地推迟第 0 和 1 部分的 super,并从我的返回适当的值第 2 部分的数据模型。
当我的数据中的行数超过第三部分的 Storyboard 中配置的行数时,我仍然在 main() 中得到 NSRangeException:
'NSRangeException',原因:'*** -[__NSArrayI objectAtIndex:]:索引 1 超出范围 [0 .. 0]'
*** 首先抛出调用栈:
(0x22f3012 0x178ae7e 0x22a8b44 0xb0ece4 0x8feee3 0x784f13 0x71940c 0x784a7b 0x789919 0x7899cf 0x7721bb 0x782b4b 0x71f2dd 0x179e6b0 0x558fc0 0x54d33c 0x54d150 0x4cb0bc 0x4cc227 0x4cc8e2 0x22bbafe 0x22bba3d 0x22997c2 0x2298f44 0x2298e1b 0x26867e3 0x2686668 0x6ceffc 0x2c4d 0x2b75)
libc++abi.dylib:终止调用抛出异常
我必须覆盖哪些父类(super class)方法才能防止发生此异常?
最佳答案
我缺少的实现是:
-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath {
返回 0;
}
这意味着总共有四种方法必须覆盖才能将动态行为注入(inject)静态原型(prototype) UITableViewController:
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
;
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
希望这可以节省一些时间。
关于ios - 具有混合静态/动态内容的 UITableViewController 中的 NSRangeException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16063501/
我正在使用 Swift 制作一个应用程序,但遇到了一个问题:我有一个系统,人们可以在其中发布“帖子”,并对这些“帖子”发表评论。 为了显示这一点,我有一个 UITableViewController
用户点击“远程”按钮,然后加载以下 UITableViewController: 然后用户选择我调用的任何值: [self.navigationController popViewController
在我离开页面并使用 UITabBarController 返回后,我的 TableViewController 在页面顶部留下了一个空隙。在初始加载时它很好,只有当我离开页面然后返回时才会出现间隙。我
我有一个 TableViewController (VC1) 设置为推送到另一个 TableViewController (VC2)。这个连接是通过从 VC1 到 VC2 的 ctrl-drag 在
在我的核心数据模型中,我有一个 Person 实体,它与 Course 实体具有“对多”关系(我还具有从 Course 到 Person 的反向“对一”关系)。 现在我有一个子类化的 UITableV
为什么不调用 numberOfSectionsInTableView 方法?如果我在 viewDidLoad 中添加 [self.tableView reloadData],它就会被调用,但即便如此,
在 UITableViewController 中,我有一个方法可以更新显示总价的底部工具栏。 public override UITableViewCell GetCell(UITa
我正在制作一个 iPad 应用程序,其中包含一个用于设置选项的 View 。这个“选项” View 有两个容器 View ,每个容器 View 都包含一个 TableView,其中包含两种不同的选项,
假设设置是 导航 Controller -> GradLevelUITableViewController -> DegreeUITableViewController -> View Control
我的问题是,这是否可能,如果可能,您将如何完成这项任务? 有人知道已经在使用此功能的应用程序,或者可以从哪里获得一些示例代码吗? 此外,如果我要在对主题了解不多的情况下自行实现此操作,您估计需要多长时
当 UITableViewController 的框架低于特定高度时,UITableViewController refreshControl 会出现问题。 就目前而言,我有一个 UIViewCont
我有我的主视图和一个 RoutinesTableViewController。 我想放松回到我的 VC 并尝试了这个: @IBAction func selectRoutine(segue:UISto
我是 swift 和 Xcode 的新手,我正在尝试一些事情。当我转到设置页面时,我想在设置页面(在应用程序中,而不是在设置 bundle 中)设置开关状态。 (我将segue设置为push)为此,我
我目前正在尝试将不同的实体从我的 CoreData 模型加载到一个 UITableView 中,但位于不同的部分下。我尝试过以下方法: override func tableView(tableVie
我试图让 tableview 适应 Swift 中键盘的显示。根据文档,如果 tableview 是 UITableViewController 的子类,它应该自动调整。已经在这里阅读了很多答案,只是
我想捕获UITableViewController中触摸点的x位置。网上描述的最简单的解决方案是UITapGestureRecognizer:enter link description here 但
我是 iPhone 编程的初学者。我的第一个应用程序是 UITableViewController 但现在我想尝试一下。这个想法是创建一个如下所示的自定义布局: 布局: ---------------
我有一个基于导航的应用程序,我将 UITableViewControllers 推送到堆栈上。我想向我的所有 UITableViewControllers 添加背景 UImage。不是 UIColor
在找到位置后,我尝试在 UITableViewController 中重新加载数据。这也意味着在 viewDidLoad 方法之后。我的类正在使用此接口(interface)扩展 UITableVie
我有一个TabBarController,其中一个选项卡包含一个 subview ,它是一个navigationController。然后,我将继承 UITableViewController 形式的
我是一名优秀的程序员,十分优秀!