0

When I click on textfield, execute this method keyboardDidShow and when I started to typing, the view will be go down. What is the reason for this ? Here is my code,

else if (textField.tag==2) {

    [self.viewUi setFrame:CGRectMake(0,-110,320,460)];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
}
return YES;

}

- (void)keyboardDidShow:(NSNotification *)notification
{
    // Assign new frame to your view
    [self.viewUi setFrame:CGRectMake(0,-110,320,460)];
}
Guillaume Jacquenot
  • 11,217
  • 6
  • 43
  • 49
Asd_123
  • 53
  • 8

2 Answers2

0

Alwin, this particular post might help you in getting this done

How to make a UITextField move up when keyboard is present?

Or trying adding the NSNotification observer at the time of loading of View Controller as in viewDidLoad.

Community
  • 1
  • 1
Jaideep Nagra
  • 519
  • 3
  • 13
0
 - (void)keyboardDidShow:(NSNotification *)notification
    {
        // Assign new frame to your view
        [self.viewUi setFrame:CGRectMake(0,-110,320,460)];
    }
NSNoob
  • 5,548
  • 6
  • 41
  • 54
kylo.mooa
  • 1
  • 1