【问题标题】:Passing an NSArray as otherButtonTitles - iOS将 NSArray 作为 otherButtonTitles 传递 - iOS
【发布时间】:2011-05-27 11:15:11
【问题描述】:

目前我正在使用

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

创建一个UIActionSheet

我想传递一个 NSArray... 类似:

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

    ...otherButtonTitles:names];

这在某种程度上可能吗?

谢谢!

【问题讨论】:

标签: iphone ios ipad


【解决方案1】:

如果数组中有这样的对象,您可以通过枚举数组来添加otherButtonTitles

(NSString * title in Strings) 

{ 
[alert addButtonWithTitle:title]; 
}

【讨论】:

    猜你喜欢
    • 2010-12-08
    • 1970-01-01
    • 1970-01-01
    • 2012-07-14
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 2019-03-06
    • 1970-01-01
    相关资源
    最近更新 更多