He creado una vista de tabla en una aplicación de iPhone utilizando el Interface Builder (IB). El estilo de mi mesa está configurado como Agrupado, y se muestra de esa manera en IB. Sin embargo, cada vez que construyo y corro, aparece como un estilo simple en el simulador.La configuración de estilo agrupado no surte efecto desde IB, UITableView
Tengo otra vista configurada para Agrupar y no tengo este problema. ¿Alguien que haya tenido el mismo problema?
El resto de la vista no se crea mediante programación, por lo que me gustaría evitar hacer eso para esta vista. Debe haber algo que me falta.
El único método tableView que estoy haciendo mucho de nada en es el método manejador de células donde estoy incorpora una caja de texto en campos de selección:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
if (indexPath.section == 0) {
if (indexPath.row == 0) {
cell.textLabel.text = @"Title";
UITextField *listTitleTextField = [ [ UITextField alloc ] initWithFrame: CGRectMake(150, 10, 145, 38) ];
listTitleTextField.adjustsFontSizeToFitWidth = YES;
listTitleTextField.textColor = [UIColor blackColor];
listTitleTextField.font = [UIFont systemFontOfSize:17.0];
listTitleTextField.placeholder = @"Your Title";
listTitleTextField.backgroundColor = [UIColor whiteColor];
listTitleTextField.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support
listTitleTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; // no auto capitalization support
listTitleTextField.textAlignment = UITextAlignmentRight;
listTitleTextField.keyboardType = UIKeyboardTypeDefault; // use the default type input method (entire keyboard)
listTitleTextField.returnKeyType = UIReturnKeyDone;
listTitleTextField.tag = 0;
listTitleTextField.delegate = self;
listTitleTextField.clearButtonMode = UITextFieldViewModeUnlessEditing; // no clear 'x' button to the right
if (self.wishList.listTitle == nil || [self.wishList.listTitle length] == 0) {
listTitleTextField.text = @"";
}
else {
listTitleTextField.text = self.wishList.listTitle;
}
[listTitleTextField setEnabled: YES ];
[cell addSubview: listTitleTextField ];
[listTitleTextField release];
}
else if (indexPath.row == 1) {
cell.detailTextLabel.text = @"Pick an Icon";
cell.textLabel.text = @"List Icon";
}
}
else {
cell.textLabel.text = @"Add Wish";
}
return cell;
}
Publique su código? –
No es realmente ningún código programático para publicar el problema, estableciendo Style en "agrupado" en IB, luego simplemente haciendo tableview I/F métodos para establecer nombres de sección y modificar la celda de la tabla según sea necesario para mostrar los valores. –
¿Está utilizando esto junto con un UITabBarController? – JamesSugrue