问题描述
|
我正在使用iPhone应用程序,正在尝试获取用于简单,可编辑的UITextView的风景视图。
两种接口布局均在NIB文件中指定,并且当设备旋转时,我已成功加载它们并迁移数据。
但是,横向版本的UITextView从iPhone键盘“运行”起来,无法看到正在编辑的内容。我不知道为什么要这么做-有人可以帮忙吗?
提前致谢!
问题视频:http://www.youtube.com/watch?v=hfWBKBA_KjQ
解决方法
没有一些代码,无法知道您在做什么,但是您应该尝试执行以下操作:
- (void) animateTextField: (UITextView*) textView up: (BOOL) up
{
const int movementDistance = 80; // tweak as needed
const float movementDuration = 0.3f; // tweak as needed
int movement = (up ? -movementDistance : movementDistance);
[UIView beginAnimations: @\"anim\" context: nil];
[UIView setAnimationBeginsFromCurrentState: YES];
[UIView setAnimationDuration: movementDuration];
self.view.frame = CGRectOffset(self.view.frame,movement);
[UIView commitAnimations];
}
从您认为合适的位置调用它(例如,UIKeyboardWillShowNotigication),然后,它将对您的视图进行动画处理以显示textview。