ios - Why is textFieldwithPlaceHolderText undefined for one view controller that conforms to UITextFieldDelegate? -
i have 2 uiviewcontroller sublcasses, both of them conform uitextfielddelegate protocol. iow, have these classes.
# myvc1.h @interface myvc1 : uiviewcontroller <uitextfielddelegate> # myvc1.m @interface myvc1 () { // private variable, not property uitextfield *_mytextfield; } @end @implementation myvc1 - (void)viewdidload { _mytextfield = [self textfieldwithplaceholdertext:@"*text"]; } @end
same code myvc2 class, except of course class name.
however, , strange part, code compiles myvc1, not myvc2. myvc2, compiler says "no visible @interface "myvc2" declares selector "textfieldwithplaceholdertext". missing myvc2? i've double- , triple-checked!
like jsdodgers said, textfieldwithplaceholdertext not method of uitextfielddelegate. check #imports section on both controllers - maybe vc1 imports category uiviewcontroller class adds method it. category import this: #import "uiviewcontroller+_.h"