ios - How to set the inputDelegate for a UITextField? -


i have uialertview containing uitextfield:

uitextfield *textfield = [alertview textfieldatindex:0]; 

now want set inputdelegate property textfield:

[textfield setinputdelegate:self]; 

my view controller (self) conforms uitextinputdelegate , has method

- (void)textdidchange:(id<uitextinput>)textinput; 

but reason method never called when change text in textfield. assume view controller not set textfield's inputdelegate.

the documentation states:

the text input system automatically assigns delegate property @ runtime. responsibility of view adopts uitextinput protocol notify input delegate @ appropriate junctures.

does mean cannot change inputdelegate of text field?

how can achieve textfield calls delegate method textdidchange: in view controller whenever contents change?

i have same experience inputdelegate never work.

i have found page you,

input delegate

however, solve problem, suggest use delegate instead!

uitextfield *textfield = [alertview textfieldatindex:0];  textfield.delegate = self; 

Comments