我已使用THIS从数据库的UITABLEVIEW的方法,它的工作就像魅力。 你是如何实现的:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
您能不能告诉我们高度的代码以及,
一些代码示例:
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
self.feed.counter = 50;
totalcustomers = [cust getTotalCustomer:@"textSearch" searchText:searchtextString custType:YES employeeId:@"" custId:[module getCurrentOrderCustomerId]];
self.currentSearchTitle = searchText;
[cust setDatabasePath:DELEGATE.databasePath];
self.feed.largeArray = (NSMutableArray *) [cust getSeachedCustomer:searchtextString custId:[module getCustomerId:[NSNumber numberWithInt:0]] action:@"textSearch"];
self.availableCustomers = self.feed.largeArray;
[self.allCustomerTable reloadData];
NSLog(@"%d ",totalcustomers);
}
和UITableviewScroll加载接下来的50条记录:
- (void)tableViewOverridedForScrollWithSearch:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSArray * newPosts;
newPosts = [self.feed newRowsFrom:indexPath.row andAction:@"textSearch" andSearchString:self.currentSearchTitle];
NSUInteger newCount = [newPosts count];
if (newCount) {
[self.availableCustomers addObjectsFromArray:newPosts];
[self.allCustomerTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
return;
}
}
}
and get next 50
- (NSArray *)newRowsFrom:(NSUInteger)newItem andAction:(NSString *)action andSearchString:(NSString *)searchString{
NSLog(@"Counter 1 Print >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> %d", self.counter);
NSArray *result = [self newRowsFromDatabase:self.counter andAction:action andSearchString:searchString];
self.counter = self.counter + 50;
NSLog(@"Counter 2 Print >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> %d", self.counter);
return result;
}
希望它会帮助你 感谢
我没有得到这将如何加快从UISearchBar搜索... 我的cellForItemAtIndexPath是非常标准的。创建一个单元格,从fetchedresults控制器获取实体对象,设置单元格属性...我没有代码高度... – BBruce 2014-09-27 16:43:01
如果您看到有两件事涉及:1.搜索和2.loareload数据集合。因此,如果数据较少,则工作正常。因此,如果用户输入“a”,则只需获得前50个数据,更新数据源并在用户滚动时重新加载collectionview.now,然后加载下一个50数据等等,我已经在我的应用程序中使用通用引擎从搜索,索引,滚动到下面实现了这样的功能,该引擎从数据中获取(搜索数据/简单的没有搜索数据,索引数据)base.i将在一段时间内显示代码片段 – Alok 2014-09-27 17:19:34