我如何code在UIActionSheet一个绿色按钮? [英] How do I code a green button in UIActionSheet?

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

问题描述

我使用的是code:


  {
        randomstatus = 0;
        味精= [[NSString的页头] initWithFormat:@干得好,你要继续吗?];
        UIActionSheet * actionSheet = [[UIActionSheet的alloc] initWithTitle:消息委托:自我cancelButtonTitle:@否destructiveButtonTitle:@是otherButtonTitles:无];
        [actionSheet showInView:self.view];
        [actionSheet发布]
        [味精放]
    }


我不想改变code,但我需要的destructiveButton是绿色的,而不是红色。这是可能的,或者我需要使用不同的按钮?


解决方案

不幸的是没有任何自定义按钮UIActionSheet正式提供的方法。

但是,您可以访问UIActionSheet的子视图(这可能在未来的iPhone OS更新突破),或添加一个新的观点与一个按钮,覆盖原有的破坏性操作按钮(再次,这可能会破坏)。

虽然没有直接关系的改变按钮的颜色上的UIActionSheet,此previous问题:<一href=\"http://stackoverflow.com/questions/743636/iphone-disabling-uiactionsheet-buttons\">http://stackoverflow.com/questions/743636/iphone-disabling-uiactionsheet-buttons演示了几种方法,你可以添加自定义视图到UIActionSheet。

I am using the code:

  {
        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];
    }   

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?

解决方案

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

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).

While not directly related to changing the color of a button on a UIActionSheet, this previous question: http://stackoverflow.com/questions/743636/iphone-disabling-uiactionsheet-buttons demonstrates a few ways you could add custom views to a UIActionSheet.

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

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