我已使用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