iOS,键盘在触摸textarea时自动向上移动

时间:2014-03-01 12:46:05

标签: ios ios6 uikeyboard

正如您在此image中看到的那样,当我触摸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: @"feedback@example.com",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];
   }

1 个答案:

答案 0 :(得分:-2)

这与您的代码无关。 用户可以从屏幕底部移动键盘或将其拆分。 已经完成了与用户相同的操作。作为用户,您需要再次按下键盘,如果这是您想要的。

并且您不会对此做任何事情,因为这是用户故意选择的行为。对于编写能够跟踪键盘出现/消失并将项目移出键盘覆盖区域的代码的人:如果键盘未对接或拆分,或者用户使用硬件键盘,则不会收到有关键盘的通知键盘覆盖的区域。