![](/img/trans.png)
[英]Autolayout UIView Proportional height with Minimum height requirement
[英]Can't resize the height of uiView proportional to keyboard
当我单击文本字段时,执行此方法keyboardDidShow
,当我开始键入内容时,视图将关闭。 这是什么原因呢? 这是我的代码,
else if (textField.tag==2) {
[self.viewUi setFrame:CGRectMake(0,-110,320,460)];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
}
return YES;
}
- (void)keyboardDidShow:(NSNotification *)notification
{
// Assign new frame to your view
[self.viewUi setFrame:CGRectMake(0,-110,320,460)];
}
Alwin,这篇特别的文章可能会帮助您完成这项工作
或者尝试在加载View Controller时像在viewDidLoad
一样添加NSNotification
观察器。
- (void)keyboardDidShow:(NSNotification *)notification
{
// Assign new frame to your view
[self.viewUi setFrame:CGRectMake(0,-110,320,460)];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.