作为UITextField委托的控制器不响应委托方法

时间:2014-05-06 08:48:44

标签: ios objective-c uitextfield uitextfielddelegate

我将textField声明为插座,通过故事板正确连接:

@property (weak, nonatomic) IBOutlet UITextField *addBillEventName;

我还通过代码和故事板设置了UITextfield的代理,代码:

-(void) viewDidAppear:(BOOL)animated {
    [self.addBillEventName setDelegate:self];
}

所以你会期待像这样的方法:

-(void) viewDidAppear:(BOOL)animated {
    [self.addBillEventName setDelegate:self];
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    NSLog(@"Touch end controller");
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
     NSLog(@"Touch end controller");
}

会触发,但不会触发。奇怪的是charactersInRange确实有效。

有谁熟悉这个问题?

0 个答案:

没有答案