UIGlassButton

From iPhone Development Wiki
Revision as of 18:50, 11 October 2009 by KennyTM~ (talk | contribs) (Created page with 'right|framed|A set of UIGlassButtons with different tint. UIGlassButton is a subclass of UIButton which is a button with glassy look. It was …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
A set of UIGlassButtons with different tint.

UIGlassButton is a subclass of UIButton which is a button with glassy look. It was once a public class in the 2.0 SDK beta period, but was dropped for some unknown reason. This class was never removed from UIKit though, just being undocumented.

Using UIGlassButton

Since UIGlassButton is a UIButton, it can be used like a normal UIButton. UIGlassButton provides an additional property, tint, which you can use to change the color of the button.

Example code:

UIGlassButton* glassButton1 = [[UIGlassButton alloc] initWithFrame:CGRectMake(20, 20, 200, 40)];
[glassButton1 setTitle:@"Foo" forState:UIControlStateNormal];
glassButton1.tintColor = [UIColor redColor];
[glassButton1 addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
[myView addSubview:glassButton1];
[glassButton1 release];

Reference