What should be the first responder: my opinion or UIDatePicker?

I create a sibling UITextField, but instead of UIDatePickera keyboard instead.

I want several of these controls to play well with each other, as well as the standard one UITextField(for example, a swap keyboard to select the date when my control is activated, and hide the date picker when the text field is activated).

One thing that bothers me is managing the status of the first responder. UIDatePickerdoesn't seem to be asking to be the first responder. Should it? Can I rely on him not becoming the first defendant and hiding the date picker when my own control is asked to dismiss the first defendant?

Should I set UIDatePicker(or something else) as my control nextResponder? I don’t want to handle any events, I just want to make sure that my control is stealing and resigning if necessary.

(in this case I do not use nibs)

+3
source share
1 answer

Override the resignFirstResponder method in your class, write your hide-UIDatePicker code in it, after checking the instance there will be a category of your sibling class.

0
source

Source: https://habr.com/ru/post/1712198/


All Articles