如何禁用UIActionSheet中的按钮? [英] How to disable button in UIActionSheet?

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

问题描述

我需要禁用UIActionSheet中的按钮.经过一些操作后,我需要再次启用它们.所以有办法做到这一点.

I need to disable the buttons in UIActionSheet. after some operations i need to enable them again. So is there a way to do this.

谢谢

推荐答案

这些按钮是UIActionSheet的子视图,其类是UIThreePartButton

Thees buttons are subviews of UIActionSheet and their class is UIThreePartButton

您可以获取它们并做您想要做的所有事情:

You can get them and do all that you want:

UIActionSheet *a = [[UIActionSheet alloc]initWithTitle:@"" delegate: nil cancelButtonTitle: @"c" destructiveButtonTitle: @"d" otherButtonTitles: @"ot", nil];
    [a showInView: window];

    for(UIView *v in [a subviews])
    {
        if([[v description] hasPrefix: @"<UIThreePartButton"] )
        {
            v.hidden = YES;  //hide
           //((UIButton*)v).enabled = NO;   // disable

        }
    }

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

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