0

I need to create a button programmatically just like in the image

alt text

I know that this is a destructive button in UIActionSheet. Is there any way to use distructive button as a UIButton ?

Thanks,

Tariq

Jacob Relkin
  • 161,348
  • 33
  • 346
  • 320
Tariq
  • 9,861
  • 12
  • 62
  • 103

3 Answers3

1

Unfortunately there is no way to set a destructive button as a UIButton,unless you create a custom button with a red gradient background image like THIS
You can create a red button like the methode specified above or like THIS

Community
  • 1
  • 1
Ajith
  • 1,457
  • 3
  • 16
  • 29
1

There are a bunch of projects like this around the net

https://github.com/0xced/UIKit-Artwork-Extractor

That use the private api to generate image files you can use with a standard UIButton. Nice little route around the problem.

Kenny Winker
  • 11,919
  • 7
  • 56
  • 78
  • Be careful before using that. It any lead to your app rejection at anytime and also your may break in future updates by apple. – Madhup Singh Yadav Dec 01 '10 at 11:44
  • @Madhup no you use that app to generate a bunch of .png files that you use in your app. No private api calls, just regular UIButtons. – Kenny Winker Dec 01 '10 at 11:50
0

No there is no way you can change the functionality of destructive Button except that you access the parts protected by apple (using private api).

You should also avoid changing the functionality as it would be against user interface guidelines and moreover it will get the users confused also.

Thanks,

Madhup

Madhup Singh Yadav
  • 8,110
  • 7
  • 51
  • 84