2

Currently i am updating a application to iOS 8. I am facing a new problem in Keyboard.

This keyboard hiding my textfield half. What i have to change for this?.

enter image description here

sathiamoorthy
  • 1,488
  • 1
  • 13
  • 23

1 Answers1

0

Ok, this worked for me.

First I binded a NSLayoutConstraint that already had.

__weak IBOutlet NSLayoutConstraint *bottomInputConstraint;

Then I subscribed to the keyboard's notification on viewDidLoad.

- (void)viewDidLoad{
  [super viewDidLoad];
  [[NSNotificationCenter defaultCenter] addObserver:self
                                           selector:@selector(keyboardWillShow:)
                                               name:UIKeyboardWillShowNotification
                                             object:nil];
}

keyboardWillShow: method looks something like this:

- (void)keyboardWillShow:(NSNotification *)aNotification{
    NSDictionary* keyboardInfo = [aNotification userInfo];
    NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameBeginUserInfoKey];
    CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue];

    bottomInputConstraint.constant = keyboardFrameBeginRect.size.height + kBottomKeyboardMargin;
}
betzerra
  • 839
  • 1
  • 8
  • 17