【发布时间】:2010-11-04 11:35:54
【问题描述】:
一个 UIActionSheet 被初始化为:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Title" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil
otherButtonTitles:@"Button1", @"Button2", nil];
我正在尝试将 NSArray 传递给“otherButtonTitles”消息。
我尝试使用以下方法传递一个 NSArray:
otherButtonTitles:[array]
但消息需要一个 NSString 列表。
我能想到的将 NSArray 分解为一组 NSString 的唯一方法是使用 componentsJoinedByString,但它给了我一个逗号分隔的列表,它是一个 NSString。
我们将不胜感激。
【问题讨论】:
-
哇...好问题!也许使用 NSInvocation 可以通过某种方式实现?
-
我只是使用了类似问题的答案来做到这一点。它对我来说效果很好。 stackoverflow.com/questions/1602214/…
标签: iphone objective-c nsstring nsarray variadic-functions