I am using date picker as input view for textfield. In view will appear I have added UIKeyboardWillShowNotification
.
My problem is that when the date picker is to be seen then also it comes KeyboardWillShowNotification
method. How can I differentiate that keyboard is seen or date picker is seen, as I need to resize table view according to that
I have assigned inputview in textfieldDidBeginEditing
cell.txtField.inputView = datePicker;
you can implement the (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
delegate and then save a local variable that you are editing your textfield at the moment like
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
self.editingTextfield = YES;
}
and in your (BOOL)textFieldShouldEndEditing:(UITextField *)textField
you set that flag to false
-(BOOL)textFieldShouldEndEditing:(UITextField *)textField {
self.editingTextfield = NO;
}
in your KeyboardWillShowNotification
notification you can check that flag to see which control issued the keyboard
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.