我认为这会很简单,但显然不是,至少对我来说不是。我UITextField在我的.h文件中声明并声明了它的属性,以及IBAction清除字段中的文本。
IBOutlet UITextField *textField1;
@property(nonatomic, retain) UITextField *textField1;
-(IBAction)clearText:(id)sender
然后在我的实现文件(.m)中,这就是我编写清除文本的方法的方式。
-(IBAction)clearText:(id)sender {
textField1.text = NULL;
}
但是当我按下模拟器中的按钮时没有任何反应。为什么?