20
我有这样的代码:如何将按钮添加到现有的UIActionSheet?
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"];
}
和它有条件地将我的LMNOP按钮的伟大的工作。
...在取消按钮后。
我该如何使用条件按钮构建我的动作表?可悲的是,我不能这样做:
UIActionSheet *actionSheet = [[[UIActionSheet alloc]
// ... etc.
otherButtonTitles: someMutableArray
// ... etc.
因为这肯定会有所帮助。
任何想法?
谢谢!
啊哈!我错过了sheet.cancelButtonIndex = ...部分;这就是我需要完成的图片。 谢谢! – Olie 2010-03-12 15:11:29
也可以使用'sheet.destructiveButtonIndex'。 – zekel 2014-06-25 16:37:22