2

Currently i'm using

...otherButtonTitles:@"Hotel Laguna", @"Hotel Village", @"Hotel Torre", @"Hotel Baia", nil];

to create an UIActionSheet.

I would like to pass an NSArray... something like:

    NSArray *names = [[NSArray alloc] 
initWithObjects:@"Hotel Laguna", @"Hotel Village", @"Hotel Torre", @"Hotel Baia", nil];

    ...otherButtonTitles:names];

Is this possible in some way?

Thanks!

Abramodj
  • 5,709
  • 9
  • 49
  • 75
  • possible duplicate of http://stackoverflow.com/questions/1602214/use-nsarray-to-to-specify-otherbuttontitles – knuku May 27 '11 at 11:44

1 Answers1

5

You can add otherButtonTitles by enumerating through an array if you have objects in an array like this:

(NSString * title in Strings) 

{ 
[alert addButtonWithTitle:title]; 
}
Abizern
  • 146,289
  • 39
  • 203
  • 257
Suny
  • 1,175
  • 1
  • 10
  • 27