tengo este código:¿Cómo agregar un botón a una hoja de UIActionSheet existente?
UIActionSheet *actionSheet = [[[UIActionSheet alloc]
initWithTitle:@"Illustrations"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles: @"ABC", @"XYZ",
nil] autorelease];
UIImage *image = // whatever, snip
if (image != nil)
{
[actionSheet addButtonWithTitle:@"LMNOP"];
}
y se hace un gran trabajo de añadir el botón de mi LMNOP condicionalmente.
... DESPUÉS del botón cancelar.
¿Cómo puedo construir mi hoja de acción con un botón condicional? Lamentablemente, no puedo hacer:
UIActionSheet *actionSheet = [[[UIActionSheet alloc]
// ... etc.
otherButtonTitles: someMutableArray
// ... etc.
porque eso sin duda ayudaría.
¿Alguna idea?
Gracias!
Aha! Me había perdido la hoja.cancelButtonIndex = ... parte; eso es lo que necesitaba para completar la imagen. Gracias! – Olie
También funciona con 'sheet.destructiveButtonIndex'. – zekel