开发者

Passing an NSArray as otherButtonTitles - iOS

开发者 https://www.devze.com 2023-03-08 15:23 出处:网络
Currently i\'m using ...otherButtonTitles:@\"Hotel Laguna\", @\"Hotel Village\", @\"Hotel Torre\", @\"Hotel Baia\", nil];

Currently i'm using

...otherButtonTitles:@"Hotel Laguna", @"Hotel Village", @"Hotel Torre", @"Hotel Baia", nil];
开发者_StackOverflow中文版

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!


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]; 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消