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?
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?
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.