1
- (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...
if(indexPath.row < 8)
{
CGRect textRect = CGRectMake(10, 10, 300, 31);
UITextField *myfield = [[UITextField alloc]initWithFrame:textRect];
myfield.borderStyle = UITextBorderStyleRoundedRect;
myfield.font = [UIFont systemFontOfSize:22.0];
myfield.adjustsFontSizeToFitWidth = YES;
myfield.minimumFontSize = 2.0;
myfield.clearButtonMode = UITextFieldViewModeWhileEditing;
myfield.keyboardType = UIKeyboardTypeDefault;
myfield.autocorrectionType= UITextAutocorrectionTypeNo;
myfield.autocapitalizationType=UITextAutocapitalizationTypeNone;
myfield.returnKeyType=UIReturnKeyDone;
[self. addSubview:myfield];
}
return cell;
}
我寫的文本框顯示在上面的代碼中的UITableViewCell(最多八個單元),但文本框在第一個單元格只顯示是有什麼錯在上面的代碼?文本框不添加到所有UITableViewCells
這是第三個問題從你的頭銜*「iphone編程」*。請使用描述性標題,如*「文本不在UITableView文本框中顯示」*。 – DarkDust 2011-01-24 13:54:52
@DarkDust:實際上,他的第五個 – BoltClock 2011-01-24 14:59:53