【发布时间】:2013-07-03 09:06:56
【问题描述】:
我在UITableview 的所有单元格中都有一个UITextView。文本视图的高度是动态增加的。随着文本视图大小的增加,我想增加该单元格的高度。
我写的是
-(BOOL)textView:(UITextView *)textView1 shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
NSLog(@"textTag%d",textView1.tag);
NSString *stringToSave = [textView1.text stringByReplacingCharactersInRange:range withString:text];
NSLog(@"Save me: %@", stringToSave);
CGFrame*frame =textView1.frame;
frame.size.height = textView1.contentSize.height;
textView1.frame = frame;
//这里我需要增加特定单元格的高度。
if([text isEqualToString:@"\n"])
{
[textView1 resignFirstResponder];
}
return YES;
}
【问题讨论】:
-
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
标签: ios objective-c cocoa-touch