Reference: http://my.oschina.net/joanfen/blog/204503
Idea: UITableView need to slide multiple contacts when too much data is loaded at once. To quickly slide through an index, 20 empty points are loaded in the index. When the user slides to the right, the index box shows the rowindex that points to the uitableview that they want to use when hitting the index point for fast scrolling. This method has a flaw: the scroll bar is obscured during normal sliding.
Main code:
Get data-(void) gettabledata{Dispatch_async (dispatch_get_global_queue (dispatch_queue_priority_default, 0), ^{ Dispatch_async (Dispatch_get_main_queue (), ^{//Get database data Self.listarray = [[Reportlogic Sharedinstanc E] getproductbycategory]; if ([self.listarray count] = = 0) {[globalapplication alert:@ "hint": @ "no data"]; }else{//Index directory, 20 empty points nsmutablearray *starray = [[Nsmutablearray alloc] init]; Self.sectiontitles = Starray; [Starray release]; for (int i=0;i<20;i++) {NSString *index = @ ""; [Self.sectiontitles Insertobject:index atindex:i]; }}//Data refresh [Self.fmtableview Reloaddata]; }); });} #pragma mark index//partition number-(Nsinteger) Numberofsectionsintableview: (UITableView *) tableview{return 1;} Index directory-(Nsarray *) sectionindextitlesfortablEview: (UITableView *) tableview{return self.sectiontitles;} Swipe to click on the catalogue-(Nsinteger) TableView: (UITableView *) TableView sectionforsectionindextitle: (NSString *) title Atindex: ( Nsinteger) index{//Fixed index focus is UITableView rowindex, tail and middle value if (index = = 0) {index = 1; }else if (index = = self.sectiontitles.count-1) {index = self.listarray.count-1; }else index = round (INDEX*SELF.LISTARRAY.COUNT/20); [Self.fmtableview scrolltorowatindexpath:[nsindexpath Indexpathforrow:index insection:0] AtScrollPosition: Uitableviewscrollpositionbottom Animated:yes]; return index;}
Effect: