self.delegate = self; ¿Qué hay de malo en hacer eso? y ¿cuál es la forma correcta de hacerlo?self.delegate = self; ¿Qué hay de malo en hacer eso?
Gracias, Nir.
Código:
(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;
}
Notas: Este es un campo de texto, y cuando me pongo el delegado a otro objeto (self.delegate = MAINVIEW) todo funciona bien, pero entonces tendrá que implementar los métodos delegados en mainView, y me gustaría ponerlos en uno mismo (una clase uiTextField que he creado). Si configuro self.delegate = self, obtengo un textField pero el teclado no aparece.
aclare: ¿Por qué sabe que estoy equivocado? Lo que está pasando –
Hola. Este es un campo de texto, y cuando estoy configurando el delegado para otro objeto (self.delegate = mainView) todo funciona bien, pero luego tendré que implementar los métodos de delegado en mainView, y me gustaría ponerlos en uno mismo (una clase de uiTextField que he creado). Si configuro self.delegate = self, obtengo un textField pero el teclado no aparece. – Tiger
Agregó el comentario de OP a la pregunta. –