0
首先,這可能嗎?IOS - 如何在分組表格視圖中混合使用文本字段和文本視圖
我有,看起來像這樣一臺iPad的細節視圖cellAtIndexPath方法代碼:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//NSLog(@"%s", __FUNCTION__);
DetailCell *cell = nil;
NSInteger tag = 0;
NSString *text = nil;
NSString *placeholder = nil;
NSUInteger section = [indexPath section];
switch (section)
{
case TitleSection:
{
cell = [self titleTextField];
text = ...
tag = ...
placeholder = @"Title";
break;
}
case UserSection:
{
if ([indexPath row] == 0) {
cell = [self usernameTextField];
text = ....
tag = ....
placeholder = ...
break;
} else {
cell = [self passwordTextField];
text = ....
tag = .....
placeholder = ...
break;
}
}
case CompanySection:
{
switch ([indexPath row]) {
case 0:
cell = [self companyTextField];
text = .......
tag = ....
placeholder = ......
break;
case 1:
break;
case 2:
break;
}
break;
}
case NotesSection:
{
cell = [self notesTextView];
text = ...
tag = ...
placeholder = @"Tap to Enter some Notes";
break;
}
}
UITextField *textField = [cell textField];
[textField setTag:tag];
[textField setText:text];
[textField setPlaceholder:placeholder];
return cell;
我想註釋部分,是一個UITextView類,而所有其他的UITextField類。
這一定是以前做過的,但我在這裏找不到參考。請點我在正確的方向..