开发者

How to insert data from second row in tableview in iphone

开发者 https://www.devze.com 2023-02-12 15:32 出处:网络
ineed 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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号