i need your help.I need to insert data dynamically 开发者_开发问答but insertion should be from the second row in the tableview in iphone.How can i do this.
You may want to fetch the data from the array w r t (indexPath.row -1), in case you are populating the table with an array
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row==0)
{
//return blank cell;
}
//add cell contents
return cell;
}
- (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];
}
// Configure the cell.
NSIndexPath *path1 = [NSIndexPath indexPathForRow:indexPath.row+1 inSection:indexPath.section];
[self configureCell:cell atIndexPath:path1];
return cell;
}
I do not tested it but it should work, try it out
精彩评论