【问题标题】:How to change the button in UIActionsheet如何更改 UIActionsheet 中的按钮
【发布时间】:2012-01-11 17:25:44
【问题描述】:

我有一个 UIActionsheet。我需要更改其中按钮的颜色。

-(IBAction)showActionSheet:(id)sender {

    UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Title" delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:@"Destructive Button" otherButtonTitles:@"Other Button 1", @"Other Button 2", nil];

    popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;

    [popupQuery showInView:self.view];

    [popupQuery release];

}

UIActionsheet 显示为this。一个红色按钮,后跟 2 个灰色按钮和黑色取消按钮。我需要前 3 个按钮为灰色,最后一个按钮为黑色。我怎样才能以编程方式做到这一点?

【问题讨论】:

  • 那么,没有其他方法可以在不添加库的情况下执行此操作吗?如果我包含这个库,苹果会接受我的应用程序吗?

标签: iphone


【解决方案1】:

破坏性按钮会自动设置为红色。创建操作表时,将破坏性按钮标题设置为 nil,并且仅对 3 个灰色按钮使用 otherButtonTitles 参数。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-11
    • 1970-01-01
    相关资源
    最近更新 更多