如何在UIActionSheet中编写绿色按钮? [英] How do I code a green button in UIActionSheet?

查看:97
本文介绍了如何在UIActionSheet中编写绿色按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的代码:


  {
        randomstatus=0;
        msg=[[NSString alloc]initWithFormat:@"Good job, do you want to continue?"];
        UIActionSheet *actionSheet=[[UIActionSheet alloc]initWithTitle:msg delegate:self cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil];
        [actionSheet showInView:self.view];
        [actionSheet release];
        [msg release];
    }   


我不想更改代码,但我需要destructiveButton是绿色而不是红色。这是可能的,还是我需要使用不同的按钮?

I don't want to change the code, but I need the "destructiveButton" to be green instead of red. Is this possible, or do i need to use a different button?

推荐答案

不幸的是没有任何官方提供的方法UIActionSheet按钮。

Unfortunately there aren't any officially provided methods for customizing UIActionSheet buttons.

但是,您可以访问UIActionSheet的子视图(可能会在未来的iPhone操作系统更新中破坏),或者添加一个新视图,其中包含原始破坏性操作按钮(再次,这可能会中断)。

However you can access the subviews of the UIActionSheet (which could break in a future iPhone OS update), or add a new view with a button that covers the original destructive action button (once again, this may break).

虽然与更改UIActionSheet上按钮的颜色不直接相关,但之前的问题是: iPhone禁用UIActionSheet按钮演示了您可以向UIActionSheet添加自定义视图的几种方法。

While not directly related to changing the color of a button on a UIActionSheet, this previous question: iPhone Disabling UIActionSheet buttons demonstrates a few ways you could add custom views to a UIActionSheet.

这篇关于如何在UIActionSheet中编写绿色按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆