0

.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 値を設定しない場合、何が間違っていますか? これはある種のインターフェイス ビルダーの設定ですか? ファイル所有者への委任リンクがあります。

4

2 に答える 2

0

Interface Builder でアウトレットをインターフェイスに接続するのを忘れた可能性があります。

その方法がわからない場合は、次を参照してください。

http://developer.apple.com/library/mac/#recipes/xcode_help-interface_builder/CreatingOutlet.html

于 2012-05-07T06:15:29.877 に答える