开发者

How to make tableviewcell text editable on touch in iPhone SDK?

In my iPhone app, I have a table vie开发者_开发百科w.

I want that when the user selects (or basically touches) on the cell of the tableview then he/she should be able to edit the cell contents.

How can I do that?


@PARTH in order to make your UITableView cells editable i suggest u to give textfields to your cell....

eg:- In

-(UITableViewCell *)reuseTableViewCellWithIdentifier:(NSString *)identifier withIndexPath:(NSIndexPath *)indexPath {


    CGRect cellRectangle = CGRectMake (0, 10, 300, 70); 
    CGRect Field1Frame = CGRectMake (10, 10, 290, 70);
    UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:cellRectangle reuseIdentifier:identifier] autorelease];
    UITextField *textField;


    //Initialize Label with tag 1.

    textField = [[UITextField alloc] initWithFrame:Field1Frame];

    textField.tag = 1;
    [cell.contentView addSubview:textField];

[textField release];
    return cell;
}

and in your cellForRowAtIndexPath method // Configure the cell.

 UITextField *txtTemp = (UITextField *)[cell.contentView viewWithTag:1];

use this where u want in your tableview accordingly otherwise hide it.....Hope it will help u!!


you need to put text field inside the table cell use this link.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜