我已經用UITableView.UITableView創建了一個iOS應用,默認加載了25條記錄。我正在滾動tableview來獲得另外25條記錄。如何使超過25條記錄的UITableView滾動顯示?
如何獲得另一組數據?
這是我的代碼。
- (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 * [email protected]"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 [email protected]"wktime";
[self presentViewController:evc animated:NO completion:Nil];
}