ロード時に項目の alloc/init を呼び出したため、ビューがカスタム ビューからのすべてのデリゲート呼び出しを無視するという非常に奇妙な問題を目の当たりにしました。その理由が気になります。
@synthesize customTextField;
-(void)viewDidLoad {
// by calling this alloc/init, none of the changes here actually update to the view
// everything is ignored from here on in.
// if I comment out the alloc/init line, everything works fine
self.customTextField = [[UITextField alloc] init];
self.customTextField.text = @"Some text";
// setting font and size as well
}
テキスト フィールド デリゲート メソッドへの呼び出しは引き続き取得されますが、特定のテキスト フィールドにリンクされるものはありませんでした。だけでは対応できませんでしたcustomTextField
。
alloc/init を呼び出すとcustomTextField
... の完全に新しいインスタンスが得られることはわかっていますが、その新しいインスタンスが IB とビューにリンクされないのはなぜですか?