【发布时间】:2011-10-24 10:53:09
【问题描述】:
我有一个 TableView,它在 didSelectRow 中加载一个详细视图。我对数据没有任何问题。 我正在使用 coreData 并使用 NSFetchedResultsController 填充 TableView。
现在,我想在 detailView 中创建下一个和上一个函数跳转到下一个或上一个 Table(row) 元素。下一个 上一个,就像在邮件应用程序中一样。
我知道我必须使用带有 IBAction 的按钮。
但是我怎样才能实现这个功能呢?
谢谢,
刷子51
编辑 1: 我已经这样做了:
- (IBAction) previousCard:(id) sender {
NSLog(@"previousBtn");
DashboardViewController *parent = (DashboardViewController *)self.parentViewController;
NSIndexPath *actualIndexPath = selectedRow2;
NSIndexPath * newIndexPath = [NSIndexPath indexPathForRow:actualIndexPath.row-1 inSection:actualIndexPath.section];
NSLog(@"newIndexPath: %@", newIndexPath);
[parent.tableViews selectRowAtIndexPath:newIndexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle]; //HERE I GET SIGABRT
}
但我得到一个错误:
-[UIViewController tableViews]: unrecognized selector sent to instance 0xd758ae0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableViews]: unrecognized selector sent to instance 0xd758ae0'
如何解决?
【问题讨论】:
标签: ios uitableview core-data row nsfetchedresultscontroller