2012-07-23 43 views
0

當我切換到另一個視圖(從拍攝圖片返回後或切換到視圖以選擇表中的東西后),ipad鍵盤出現在錯誤的位置。 當我選擇一個文本字段時,我在我的Ipad和模擬器上看到了這個。 (無法發佈圖片)。如果我轉動我的iPad(使其水平對齊)並旋轉回來,鍵盤恢復正常。ipad:keybord在錯誤的位置

https://devforums.apple.com/servlet/JiveServlet/showImage/2-701040-19966/Screen+Shot+2012-07-20+at+16.36.20.png

我的代碼,切換到相機拍攝照片......

- (IBAction)getCameraPicture:(id)sender 
{ 
    UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
    picker.delegate = self; 
    picker.allowsEditing = YES; 
    picker.sourceType = UIImagePickerControllerSourceTypeCamera; 
    picker.title = @"CameraPicture"; 
    [self presentModalViewController:picker animated:YES]; 
} 

我的代碼切換到視圖與表吧:

[self presentModalViewController:viewControllerSpanoTechProducts animated:YES]; 

選擇內容後返回代碼:

[self dismissModalViewControllerAnimated:YES]; 

我的應用程序的工作原理:您有一個帶按鈕和文本框的主屏幕以填寫表單。當您按下按鈕選擇產品時,我會切換到另一個具有表格的視圖控制器,您可以在其中選擇產品和「完成」按鈕。如果你點擊'完成'按鈕,我切換回原來的視圖..希望這有助於? 我剛剛開始與iOS ..任何幫助appriciated!

+0

你的應用程序的流程不清楚,你能給出更多的細節......? – Nilesh 2012-07-23 07:49:42

+0

我編輯了我的帖子。希望它有幫助... – Jos 2012-07-23 13:08:22

回答

0

在切換用戶該代碼的時間:

[yourTextFieldObject resignFirstResponder]; 

這可能會實現。

+0

thanx的答覆,它不工作。認爲它在一個行動的順序工作,但我有多個文本字段和viewcontrollers ..其他想法? – Jos 2012-07-23 13:04:28