Note that there are some explanatory texts on larger screens.

plurals
  1. POUITextField.text property return nil
    primarykey
    data
    text
    <p>I have this code: (nomEquipo is a UITextField class variable)</p> <pre><code>nomEquipo = [[UITextField alloc] initWithFrame: CGRectMake(5, yPosition, modificar.frame.size.width - 10, 30)]; [nomEquipo setPlaceholder: @"Nombre del equipo"]; [nomEquipo setBorderStyle: UITextBorderStyleRoundedRect]; [nomEquipo setAutocorrectionType: UITextAutocorrectionTypeNo]; [nomEquipo setReturnKeyType: UIReturnKeyDone]; [nomEquipo addTarget: self action: @selector(ocultarTeclado:) forControlEvents: UIControlEventTouchUpInside]; [modificar addSubview: nomEquipo]; </code></pre> <p>then in other method:</p> <pre><code>- (IBAction) crearEquipoReal:(id)sender { NSLog(@"%@",nomEquipo.text); if ([nomEquipo.text length] == 0) { UIAlertView *alerta = [[UIAlertView alloc] initWithTitle: @"Aviso" message: @"Debe introducir al menos el nombre del equipo" delegate: self cancelButtonTitle:@"Aceptar" otherButtonTitles:nil, nil]; [alerta show]; } } </code></pre> <p>This NSLog returns:</p> <pre><code>2013-04-11 15:40:10.184 GeoRuta_v1[7157:907] (null) </code></pre> <p>Code where I put text in my UITextFields:</p> <pre><code>-(void)didChangeComboBoxValue:(AJComboBox *)comboBox selectedIndex:(NSInteger)selectedIndex { if (comboBox == self.combo) { equipoActual = (Equipo *) [listaEquipos objectAtIndex: selectedIndex]; nomEquipoActual = equipoActual.nombreEquipo user.idEquipo = equipoActual.idEquipo; } else if (comboBox == self.equiposMod) { Equipo *aux = (Equipo *) [listaEquiposMod objectAtIndex: selectedIndex]; user.idEquipo = aux.idEquipo; descEquipo2.text = aux.descEquipo; nomEquipo2.text = aux.nombreEquipo; } } </code></pre> <p>My surprise comes when it happens suddenly, it has been working for 2 days I programmed it.</p> <p>Thanks for your help.</p> <p><strong>EDIT1:</strong> * [FIX] I fixed with 2 UITextField, because I was generating that <code>nomEquipo</code> twice .... :(</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload