Sunday, 18 August 2013

Why is textFieldwithPlaceHolderText undefined for one view controller that conforms to UITextFieldDelegate?

Why is textFieldwithPlaceHolderText undefined for one view controller that
conforms to UITextFieldDelegate?

I have two UIViewController sublcasses, both of them conform to the
UITextFieldDelegate protocol. IOW, I have these classes.
# MyVC1.h
@interface MyVC1 : UIViewController <UITextFieldDelegate>
# MyVC1.m
@interface MyVC1 () {
// Private variable, so not a property
UITextField *_myTextField;
}
@end
@implementation MyVC1
- (void)viewDidLoad
{
_myTextField = [self textFieldwithPlaceHolderText:@"*Text"];
}
@end
SAME CODE for MyVC2 class, except of course the class name.
However, and this is the strange part, my code compiles for MyVC1, but NOT
for MyVC2. For MyVC2, compiler says "No visible @interface for "MyVC2"
declares the selector "textFieldwithPlaceHolderText". What am I missing
for MyVC2? I've double- and triple-checked!

No comments:

Post a Comment