tags:

views:

395

answers:

3

I would like put UIButton on my UIViewController with style like have buttons in UIActionSheet. What should i add here:

UIButton *button = [UIButton buttonWithType: UIButtonTypeCustom];
[ button setFrame: CGRectMake(10, 10, 50, 35) ];
[button setTitle:@"Button from UIActionSheet" forState: UIControlStateNormal];
[self addSubview: button];
+1  A: 

You need to get the background image from somewhere and then set it using: - (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state

I believe the .psd linked here has the action button background image http://media.photobucket.com/image/uiactionsheet%20button%20psd/visionwidget/iphone-gui-psd-file.jpg

klaaspieter
A: 

Maybe exists some simple way like set some property?

Jonny
Nope. If it isn’t in the documentation, you probably can’t do it out of the box.http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIButton_Class/index.html
Jonathan Sterling
A: 

Here is a post on using Apple's private UIGlassButton class.

You can't submit an app like this to the app store, but you can capture the generated background image to reuse in your published apps.

Frank Schmitt