在.h里面:
@interface MyController : UIViewController<UITextFieldDelegate> {
IBOutlet UITextField *phonenum;
IBOutlet UITextField *email;
}
@property (nonatomic, retain) UITextField *phonenum;
@property (nonatomic, retain) UITextField *email;
-(IBAction) btnClicked: (id) sender;
@end
在.m里面:
-(IBAction) btnClicked: (id) sender{
NSString *str = [[NSString alloc]init];
NSLog(@"str=%@",str); //this contains valid value
email.text=str; /// does not set the value
[[self email] setText: str]; // does not set the value
}
在没有使用 NSString 的变量 str 设置 UITextField 值的情况下,我做错了什么?这是某种接口生成器设置吗?我有文件所有者的委托链接。