我想給在tableviewcell文本框我writen一些代碼,我可以看到細胞文本框,但是當我去下一個單元格,然後我的價值是即消失,以及如何給細胞鍵盤即消失,請檢查這個代碼,我對細胞writen,請幫我如何從細胞即消失鍵盤。如何給細胞文本框在iphone
我想給文本框不僅在一排在所有行。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
if ([indexPath row] == 0 && [indexPath section] == 0)
{
[email protected]"Tags";
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 185, 30)];
cell.accessoryView = textField;
}
if ([indexPath row] == 1 && [indexPath section] == 0)
{
[email protected]"Notes";
cell.detailTextLabel.text=app.Notes;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
}