2011-06-13 66 views
2

我正在研究一个iPhone应用程序,并试图让一个简单的,可编辑的UITextView工作的横向视图。iPhone键盘在进入时隐藏了UITextView?

这两个界面布局都是在NIB文件中指定的,并且我已成功加载它们并在设备旋转时迁移数据。

但是,Landscape版本中的UITextView“从iPhone键盘”跑掉“,使得无法看到您正在编辑的内容。我不知道为什么这样做 - 任何人都可以帮忙吗?

在此先感谢!

VIDEO问题:http://www.youtube.com/watch?v=hfWBKBA_KjQ

+0

也许不是视频,你可能会发布一些代码? – PengOne 2011-06-13 15:06:47

回答

5

没有办法知道你没有一些代码在做什么,但你应该尝试这样的事:

- (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, 0, movement); 
    [UIView commitAnimations]; 
} 

从那里你觉得appropiate调用此(UIKeyboardWillShowNotigication,例如),以及它会动画您的视图,以显示文本视图。

+0

你可以发表一个例子从哪里调用它? – Dejell 2012-09-10 20:54:55