UITextField 似乎没有调用 textFieldShouldBeginEditing
我正在尝试禁用 UITextField 打开键盘,但我遇到了麻烦
。h
#import <UIKit/UIKit.h>
@interface XXViewController : UIViewController <UITextFieldDelegate> {
IBOutlet UITextField* someTextField;
}
@property (nonatomic, retain) IBOutlet UITextField* someTextField;
@end
.m
@implementation XXViewController
@synthesize someTextField;
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
NSLog(@"Hello");
return NO;
}
...
我确信这是一个非常简单的问题。我一直在寻找很长时间,但找不到解决方案
感谢提前
编辑: NSLog 没有被调用。
I am trying to disable UITextField from opening the keyboard but I am having trouble
.h
#import <UIKit/UIKit.h>
@interface XXViewController : UIViewController <UITextFieldDelegate> {
IBOutlet UITextField* someTextField;
}
@property (nonatomic, retain) IBOutlet UITextField* someTextField;
@end
.m
@implementation XXViewController
@synthesize someTextField;
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
NSLog(@"Hello");
return NO;
}
...
I am sure this is a very simple problem. I have been searching for ages and couldn't find a solution
Thanks Advance
EDIT:
NSLog isn't being called.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要这样做:
因为虽然您的类可以是委托,但您从未将其设置为您正在使用的 UITextField 的委托。
You need to do:
Because although your class can be a delegate you never set it as the delegate for the UITextField you are using.