ViewController 由一个带有静态(自定义)单元格的 TableView 组成。其中一行包含一个 UITextView,它显示 2 行文本(作为预览)。当用户点击它时,它会打开一个 UITextView 填满全屏。
else if (indexPath.row == 3) {
static NSString *countryRegionCellID = @"NotesCell";
NotesCell *cell = (NotesCell *)[tableView dequeueReusableCellWithIdentifier:countryRegionCellID];
if (!cell) {
NSArray* topLevelObjects = [[NSBundle mainBundle] loadNibNamed:countryRegionCellID owner:self options:nil];
for (id currentObject in topLevelObjects) {
if ([currentObject isKindOfClass:[NotesCell class]]) {
cell = (NotesCell *)currentObject;
break;
}
}
}
[self drawBorder:cell];
[self drawPersonalNotes:cell];
return cell;
}
UITextView 委托调用:
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
NSLog(@"textViewShouldBeginEditing");
[textView becomeFirstResponder];
CGRect r = [[UIScreen mainScreen] bounds];
[textView setFrame:r];
return YES;
}
- (void)textViewDidBeginEditing:(UITextView *)textView
{
NSLog(@"textViewDidBeginEditing");
}
由于静态单元格的定义高度为 44,因此 UITextView 仅填充单元格而不是全屏。我是否在表格视图之上引入了一个新的视图控制器?谢谢。