您的位置:首页 > 产品设计 > UI/UE

动态输入文字 uitextView的frame动态改变

2015-10-08 15:04 405 查看
UITextView * text =[[UITextView alloc]initWithFrame:CGRectMake(0, 100, 200, 20)];
[self.view addSubview:text];

text.backgroundColor =[UIColor lightGrayColor];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ValueChange:) name:UITextViewTextDidChangeNotification object:nil];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)ValueChange:(NSNotification *)obj
{
UITextView * textView = obj.object;
CGRect rect = textView.frame;
rect.size.height =textView.contentSize.height ;
textView.frame = rect ;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: