UIAdvancedButton Class Reference
UIAdvancedButton Class Reference
Inherits from Conforms to UIView : UIResponder : NSObject NSCoding (UIView) NSObject (NSObject) /System/Library/Frameworks/UIKit.framework /System/Library/Frameworks/QuartzCore.framework Available in iOS 4.2 and later.
Overview
The UIAdvancedButton class is a subclass of UIView which can be used to create Glossy, 3D like buttons with less than 2 lines of code. Customize the glow, shadow and colors the way you want with easy to use built-in methods. To use this class add the framework QuartzCore.framework to the project.
Tasks
Initializing a View Object
-initWithFrame: - initWithFrame:text:cornerRadius:buttonStyle:hasShadow:hasGlow: - initWithFrame:text:cornerRadius:backgroundColors:hasShadow:hasGlow:
Instance Methods
initWithFrame:
Returns a advanced button initialized with the specied frame with default label as "Label". - (id)initWithFrame:(CGRect *)frame Parameters frame The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly. Return Value An initialized Advanced Button object or nil if the object couldn't be created. Discussion This method initializes and returns the Advanced button object with the specied size and position.
initWithFrame:text:cornerRadius:buttonStyle:hasShadow:hasGlow:
Returns an advanced button initialized with the specied frame and style. - (id)initWithFrame:(CGRect *)frame text:(NSString *)text cornerRadius:(CGFloat *)radius buttonStyle: (UIAdvancedButtonStyle)style hasShadow:(BOOL)hasShadow hasGlow:(BOOL)hasGlow Parameters frame The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly. text The text to be displayed in the button. radius The radius of the corners to give round rect effect. Give 0 if you want a rectangular base. style The predened button style. Instead of specifying colors for the button you can choose from any of the predened style for the button being made.
Currently available styles are UIAdvancedButtonStylePureBlack UIAdvancedButtonStyleClassyBlue UIAdvancedButtonStyleGrayMix UIAdvancedButtonStyleGloxyGray UIAdvancedButtonStyleTellyGreen UIAdvancedButtonStyleRoyalRed UIAdvancedButtonStyleRoyalGreen UIAdvancedButtonStyleRoyalBlue hasShadow A BOOL which species whether the button will have a shadow. hasGlow A BOOL which species whether the button will have a glow or glossy effect. Return Value An initialized Advanced Button object or nil if the object couldn't be created. Discussion This method initializes and returns the Advanced button object with the specied size, position and style.
initWithFrame:text:cornerRadius:backgroundColors:hasShadow:hasGlow:
Returns an advanced button initialized with the specied frame and style. - (id)initWithFrame:(CGRect *)frame text:(NSString *)text cornerRadius:(CGFloat *)radius backgroundColors:(NSArray *)colors hasShadow:(BOOL)hasShadow hasGlow:(BOOL)hasGlow Parameters frame The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly. text The text to be displayed in the button. radius The radius of the corners to give round rect effect. Give 0 if you want a rectangular base. colors A NSArray object which should contain one or more CGColorRef objects which dene the background colors of the button. hasShadow A BOOL which species whether the button will have a shadow. hasGlow A BOOL which species whether the button will have a glow or glossy effect. Return Value An initialized Advanced Button object or nil if the object couldn't be created. Discussion This method initializes and returns the Advanced button object with the specied size, position and style.
animateToColors:duration:
Changes and animate the background color of the button from the current color to specied color. -(void) animateToColors:(NSArray *)colors duration:(CGFloat)duration; Parameters colors The colors to be applied to the background. duration The duration for which the animation should take place. Discussion This method changes the background color to colors specied in the color array and perform a transition animation for the specied duration.
setTextFont:textColor:
Changes the font and color of the button text. - (void)setTextFont:(UIFont *)font textColor:(UIColor *)color
Parameters font The font to be used for the displayed text. color The color to be used for the displayed text. Discussion This method changes the font and color of the displayed text.
setShadow:shadowRadius:shadowColor:
Changes shadow radius and shadow color of the button. - (void)setShadow:(BOOL)hasShadow shadowRadius:(CGFloat)radius shadowColor:(UIColor *)color Parameters hasShadow A BOOL indicating whether to turn on or off the shadow of the button. radius The radius (spread of the shadow) to be used for the shadow. color The color to be used for the shadow. Discussion This method adds/remove the shadow of the button and changes the radius and color of the shadow if any.
setGlow:
Add or remove the glow effect of the button. - (void)setGlow:(BOOL)hasGlow Parameters hasGlow A BOOL indicating whether to turn on or off the glow of the button. Discussion This method adds/remove the glow or glossy effect of the button.
setText:
Add or remove the glow effect of the button. - (void)setText:(NSString *)text Parameters text The text of the button to be displayed. Discussion This method changes the text of the button to the string identied by the text variable.