[英]Textview Frame is become squeez and cannot come back to its original form?
keyboardWillShow method implementation : keyboardWillShow方法的实现:
- (void)keyboardWillShow:(NSNotification *)notification
{
[UIView beginAnimations:nil context:nil];
CGRect endRect = [[notification.userInfo
objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect newRect = txtNotes.frame;
//Down size your text view
newRect.size.height -= endRect.size.height;
txtNotes.frame = newRect;
[UIView commitAnimations];
}
keyboardWillHide method implementation : keyboardWillHide方法的实现:
- (void)keyboardWillHide:(NSNotification *)notification
{
// Resize your textview when keyboard is going to hide
UIEdgeInsets contentInsets = UIEdgeInsetsZero;
txtNotes.contentInset = contentInsets;
txtNotes.scrollIndicatorInsets = contentInsets;
}
Couple of things: 几件事情:
1) META: You should add 4 spaces before each of the code lines to get the code to display properly. 1)META:您应该在每行代码之前添加4个空格,以使代码正确显示。
2) This looks like a basic constraints issue. 2)这看起来是一个基本的约束问题。 You should examine the Auto Layout of your storyboard. 您应该检查情节提要的“ 自动布局 ”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.