2014-03-01 34 views
0

正如您在此image中看到的那樣,當我觸摸textarea時,鍵盤會變得過高。任何想法是什麼導致這個特定的問題。我怎樣才能讓鍵盤粘到屏幕的底部?iOS,當觸摸textarea時,鍵盤會自動向上

[更新](代碼):

#import "ViewController.h" 
    #import <MessageUI/MessageUI.h> 
    @interface SettingsViewController() <MFMailComposeViewControllerDelegate> 
    @end 
    @implementation ViewController 
    - (IBAction)feedBack:(id)sender { 
    NSString *iOSVersion = [[UIDevice currentDevice] systemVersion]; 
    NSString *model = [[UIDevice currentDevice] model]; 
    NSString *version = @"1.0"; 
    MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init]; 
    mailComposer.mailComposeDelegate = self; 
    [mailComposer setToRecipients:[NSArray arrayWithObjects: @"[email protected]",nil]]; 
    [mailComposer setSubject:[NSString stringWithFormat: @"Feedback about App V%@",version]]; 
    NSString *supportText = [NSString stringWithFormat:@"Device: %@\niOS Version:%@\n\n",model,iOSVersion]; 
    supportText = [supportText stringByAppendingString: @"Please write your feedback or suggestions"]; 
    [mailComposer setMessageBody:supportText isHTML:NO]; 
    [self presentViewController:mailComposer animated:YES completion:nil]; 
    } 
    - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult: (MFMailComposeResult)result error:(NSError *)error 
    { 
    [self dismissViewControllerAnimated:YES completion:nil]; 
    } 
+0

這不是默認行爲,所以除非你顯示一些代碼,否則很難確定是什麼原因造成的。 – Vrasidas

+0

你如何呈現視圖控制器? – Wain

+0

嘿,這是非常奇怪的。狂猜,你是否在任何地方使用inputAccessoryView? – Fattie

回答

-2

這已無關,與你的代碼。 用戶可以從屏幕底部移動鍵盤或將其分開。 已經完全按照用戶的方式完成了。作爲用戶,您需要再次拖動鍵盤,如果這是您想要的。

而你對此不做任何事情,因爲這是用戶故意選擇的行爲。對於編寫代碼來跟蹤鍵盤顯示/消失以及將項目移出鍵盤覆蓋區域的人員:如果鍵盤未連接或拆分,或者用戶使用硬件鍵盤,則不會收到有關鍵盤覆蓋的區域。

+0

用戶不能滑動鍵盤,仍然會收到帶有硬件鍵盤的通知,而未鎖定到屏幕底部的ios鍵盤只是默認行爲。 – Logan

+0

你試過了嗎?將鍵盤分成兩部分 - >沒有通知。斷開鍵盤 - >沒有通知。 – gnasher729

+0

我沒有說分裂/分離會給你通知。我說,硬件鍵盤仍然會提供通知,並且在iPhone(有問題的設備)上,您無法取消鎖定/滑動鍵盤。 – Logan