开发者

UIButton like in UIActionSheet

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];
[ 开发者_如何学Pythonbutton setFrame: CGRectMake(10, 10, 50, 35) ];
[button setTitle:@"Button from UIActionSheet" forState: UIControlStateNormal];
[self addSubview: button];


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


you can using segmented control - very good trick

segmented =  [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Info",@"Configuration", nil]] autorelease];
[segmented addTarget:self action:@selector(changeView:) forControlEvents:UIControlEventValueChanged];
segmented.tintColor = [UIColor colorWithRed:0.20 green:0.20 blue:0.52 alpha:1.0];
segmented.segmentedControlStyle = UISegmentedControlStyleBar;


Maybe exists some simple way like set some property?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜