iphone - How to reload UITableView step by step? -
i working on application , have show 10 records in table view 1 time if user want see more records user have click on "see more records" cell, user able see more records.
if 1 know please give me solution. thanx
this simple prototype of can do:
-(nsinteger)numberofsectionsintableview:(uitableview *)tableview{ return 1; } -(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section{ if ([self.tabledata count]>window) { return window+1; } else{ return [self.tabledata count]; } } -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; } if (indexpath.row<window) { cell.textlabel.text=[self.tabledata objectatindex:indexpath.row]; } else{ cell.textlabel.text=@"loadmore"; } return cell; } -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{ if (indexpath.row==window) { window=window+step; [tableview reloaddata]; } }
table data array contains data want show in tableview, window number of lines show , used set range of show, step number of new items add in every new load
Comments
Post a Comment