-3

I have 3 textfields. I created a dynamic animation for view depending on the position of textfield but when I check the "connect hardware keyboard", the view makes the animation area black.

Could anybody help me?

Dhara
  • 6,587
  • 2
  • 31
  • 46
  • In simulator, select the Hardware tab, now in Keyboard section you need to select the other option that is toggle software keyboard, this will display keyboard as usual in your view, and this black area will be replaced by the software keyboard. – NewStackUser Aug 20 '15 at 08:17
  • your question is different to the title, i'm confuzzled – Ben Aug 20 '15 at 08:53

1 Answers1

1

There are 4 notifications that you can register for. Here's an example:

#pragma mark - Lifecycle

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillAppear:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillDisappear:) name:UIKeyboardWillHideNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidAppear:) name:UIKeyboardDidShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidDisappear:) name:UIKeyboardDidHideNotification object:nil];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

#pragma mark - Notifications

- (void)keyboardWillAppear:(NSNotification *)note
{

}

// E.t.c

The good thing about these notifications is that they are only fired if the virtual keyboard is toggled. Therefore you can trigger your view shift using these notifications. When the user connects a hardware keyboard nothing will happen.

Rob Sanders
  • 5,197
  • 3
  • 31
  • 58