0
Q
多索引路径
A
回答
0
我不完全确定你的问题,但它听起来像你想要一个表,其中一节包含NSFetchedResultController的结果,另一节包含来自其他源的数据。这很容易做到。如果您的数据可以不需要在多个部分,然后它很容易,只要得到fetchedResultController为第0,和别的数据为第1
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if(section == 0){
id sectionInfo = [[fetchedResultsController sections] objectAtIndex:section];
return [sectionInfo numberOfObjects];
}else{
return self.someArray.Count;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexpath.section == 0){
static NSString *CellIdentifier = @"data cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSObject *foo = [self.fetchedResultController objectAtIndexPath:indexPath];
//configure cell
return cell;
}else{
static NSString *CellIdentifier = @"some other cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//configure cell
return cell;
}
}
相关问题
- 1. CherryPy索引路径
- 2. 索引路径索引目录
- 3. 索引路径0行
- 4. htaccess忽略/索引/路径
- 5. 资源的路径索引
- 6. Typo3索引搜索Local_Lang路径
- 7. PHP路径中的未定义索引
- 8. 获取UiTableView标头的索引路径?
- 9. 设置索引路径供参考
- 10. _shouldShowMenuForCell中的意外nil索引路径
- 11. UITableViewCell显示索引路径行乱序
- 12. 绑定NSOutlineView的选择索引路径
- 13. Rails 3 - 缺少索引路径?
- 14. 使用索引路径查询XMl
- 15. 非法字符在索引路径16
- 16. 无效索引路径错误
- 17. 如何从UICollectionView中的索引路径正确获取索引?
- 18. iOS查询多维数组并返回索引路径
- 19. 添加路径到Erlang搜索路径?
- 20. 跟踪当前选择的索引路径和先前选择的索引路径
- 21. .so搜索路径
- 22. dlopen()搜索路径
- 23. 类路径搜索
- 24. Laravel路由的搜索引擎优化路径/表
- 25. 非索引根路径与Marionette路由器
- 26. Floyd-Warshall算法 - 最短路径 - 将路径索引保存到数组
- 27. 在PreparetoSegue期间检索选定的UICollectionViewCell的索引路径?
- 28. Progammatically分割路径成多条路径
- 29. ServiceStack多个路由路径
- 30. 防止搜索引擎在其路径中使用3个或更多forwararslasing索引页面
谢谢你,这就是我一直在寻找。 – Luke 2012-07-07 21:13:30