¿Puede un UIVIEW ser un delegado de UITextfield?
-
27-10-2019 - |
Pregunta
Recibo un error de SigAbrt cuando intento configurar el delegado de mi UITextfield en mi clase UIView. He usado la protocal UITextFieldDelgate. Aquí está mi código
nameField = [[UILabel alloc] initWithFrame:CGRectMake(130, 40, 200, 30)];
[nameField setDelegate:self];
nameField.placeholder = @"<Game Name>";
nameField.textAlignment = UITextAlignmentCenter;
[self addSubview:nameField];
Solución
Estás a punto de usar UITextField
en constructor, no UILabel
. Reemplace su primera cadena con la siguiente:
nameField = [[UITextField alloc] initWithFrame:CGRectMake(130, 40, 200, 30)];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow