2011-06-13 68 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