objective c - How to make UITableView scroll show on more than 25 records? -
i have created ios app uitableview.uitableview default loads 25 records. scrolling tableview 25 records.
how set of data?
here code.
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section{ return timelist.count; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellidentifier = @"item"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell=[[uitableviewcell alloc]initwithstyle: uitableviewcellstylesubtitle reuseidentifier:cellidentifier]; } nsdictionary *tmpdict = [timelist objectatindex:indexpath.row]; nsmutablestring *text; nsstring *currentstatus; text = [nsmutablestring stringwithformat:@"%@",[tmpdict objectforkeyedsubscript:startdate]]; currentstatus = [self statusstring:[nsmutablestring stringwithformat:@"%@",[tmpdict objectforkeyedsubscript:status]]]; nsmutablestring *detail; detail = [nsmutablestring stringwithformat:@"user:%@ , hours:%@ , status: %@ ", [tmpdict objectforkey:username], [tmpdict objectforkey:hours], currentstatus]; cell.textlabel.text = text; cell.detailtextlabel.text= detail; cell.accessorytype =uitableviewcellaccessorydisclosureindicator; return cell; } -(void) tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{ nsdictionary *tmpdict = [timelist objectatindex:indexpath.row]; nsstring * storyboardname=@"main"; uistoryboard *storyboard =[uistoryboard storyboardwithname:storyboardname bundle:nil]; editviewcontroller *evc =[storyboard instantiateviewcontrollerwithidentifier:@"editviewcontroller"]; evc.startday =[nsmutablestring stringwithformat:@"%@",[tmpdict objectforkeyedsubscript:startdate]]; evc.user_id = [nsmutablestring stringwithformat:@"%@",[tmpdict objectforkeyedsubscript:user_id]]; evc.tab =@"wktime"; [self presentviewcontroller:evc animated:no completion:nil]; }
first have check whether tableview reached last cell or not. if reached again have reload next set of data.
use below code check whether tableview reached last cell or not.
-(void)tableview:(uitableview *)tableview willdisplaycell (uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath { if(indexpath.row == timelist.count-1) { //your code here } }
Comments
Post a Comment