I write a custom view CustomViewA : UIView<UITextFieldDelegate>and implements the delegate's methods.
And in the CustomViewA's init I write:
- (id)initWithFrame:(CGRect)frame {
self = [[[NSBundle mainBundle] loadNibNamed:@"CustomViewA" owner:self options:nil] objectAtIndex:0];
if (self) {
//the txtfieldA is a IBOutlet property linked to the nib file.
self.txtfieldA.delegate = self; //not work
}
return self;
}
And in this xib file includes a UITextField control which I set its delegate in the init method.But when I run this and edit the textfield, the delegate's methods are not called.Can anyone tell me why? And how can I fix it??