如何使UIButton看起来像删除按钮(iphone / iPad)? 3

时间:2013-10-07 05:45:41

标签: ios objective-c uibutton

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

2 个答案:

答案 0 :(得分:0)

很遗憾无法将破坏性按钮设置为UIButton,除非您使用红色渐变背景图像创建自定义按钮,例如THIS

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

答案 1 :(得分:0)

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex   

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

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 
{
    switch(buttonIndex)
    {
        case 0:

        [button removefromsuperview];

    }
}