在我的iPhone應用程序中,我有一個表格視圖。如何使iPhone SDK中的觸摸可編輯tableviewcell文本?
我希望當用戶選擇(或基本觸摸)tableview的單元格時,他/她應該能夠編輯單元格內容。
我該怎麼做?
在我的iPhone應用程序中,我有一個表格視圖。如何使iPhone SDK中的觸摸可編輯tableviewcell文本?
我希望當用戶選擇(或基本觸摸)tableview的單元格時,他/她應該能夠編輯單元格內容。
我該怎麼做?
@PARTH爲了使您的UITableView細胞可編輯的我建議ü給文本框到您的....
例如: - 在
-(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;
}
並在你的cellForRowAtIndexPath
方法//配置單元格。
UITextField *txtTemp = (UITextField *)[cell.contentView viewWithTag:1];
使用這個你想在你的tableview相應,否則隱藏它.....希望它會幫助你!
你需要把文本字段的表單元格內使用此link.