【问题标题】:How can I make a UIButton look like a delete button (iphone/iPad)? 3如何使 UIButton 看起来像删除按钮(iphone/iPad)? 3
【发布时间】:2013-10-07 05:45:40
【问题描述】:

我有一个图像视图,上面有以编程方式创建的UIButtons。我想通过UIActionSheet 删除这些按钮。这在 iPad 上可行吗?请帮帮我。

【问题讨论】:

    标签: ios objective-c uibutton


    【解决方案1】:

    不幸的是,没有办法将破坏性按钮设置为UIButton,除非您创建带有红色渐变背景图像的自定义按钮,例如THIS

    您可以像上面指定的方法或THIS一样创建一个红色按钮

    【讨论】:

    • 我面临一个问题,每当我删除特定按钮时,每次最后一个按钮都会被删除。
    【解决方案2】:
    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex   
    

    使用这些操作表委托方法,您可以删除以编程方式创建的按钮,例如:

    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 
    {
        switch(buttonIndex)
        {
            case 0:
    
            [button removefromsuperview];
    
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-05
      • 2011-07-28
      • 1970-01-01
      • 2019-06-01
      • 1970-01-01
      • 2017-11-03
      • 1970-01-01
      相关资源
      最近更新 更多