self.delegate = self;
それをして何が悪いのですか?それを行う正しい方法は何ですか?
ありがとう、ニル。
コード:
(UITextField*)initWith:(id)sender:(float)X:(float)Y:(float)width:(float)hieght:(int)textFieldTag {
if (self = [super initWithFrame:CGRectMake(X, Y,width, hieght)]) {
finalText = [[NSMutableString alloc] initWithString:@""];
senderObject = sender;
self.textColor = [UIColor blackColor];
self.font = [UIFont systemFontOfSize:17.0];
self.backgroundColor = [UIColor whiteColor];
self.autocorrectionType = UITextAutocorrectionTypeNo;
self.keyboardType = UIKeyboardTypeDefault;
self.returnKeyType = UIReturnKeyDone;
self.clearButtonMode = UITextFieldViewModeWhileEditing;
self.tag = textFieldTag;
self.delegate = self;
[sender addSubview:self];
}
return self;
}
注: これはテキスト フィールドです。デリゲートを別のオブジェクト (self.delegate = mainView) に設定すると、すべて正常に動作しますが、mainView にデリゲート メソッドを実装する必要があり、それらを配置したいと考えています。 self (私が作成した uiTextField クラス)。self.delegate = self を設定している場合、textField は取得できますが、キーボードが表示されません。