#import <Y3GradientButton.h>
Definition at line 11 of file Y3GradientButton.h.
◆ makeGradientButton:withFrame:()
+ (Y3GradientButton *) makeGradientButton: |
|
(NSString *) |
caption |
withFrame: |
|
(CGRect) |
menuButtonFrame |
|
|
| |
Definition at line 16 of file Y3GradientButton.m.
16 :(NSString *) caption withFrame: (CGRect) menuButtonFrame {
18 [menuButton setFrame:menuButtonFrame];
20 [menuButton setBackgroundColor:[UIColor colorWithHue:0.23 saturation:0.9 brightness:1.0 alpha:1.0]];
23 menuButton.layer.borderColor = [[UIColor blackColor] CGColor];
26 [menuButton setTitleEdgeInsets:UIEdgeInsetsMake(2, 2, 2, 2)];
27 [menuButton setTitle:caption forState:UIControlStateNormal];
28 [menuButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
29 [menuButton setTitleColor:[UIColor yellowColor] forState:UIControlStateSelected];
31 UIFont *expandedFont = [UIFont fontWithName:@"Verdana-Bold" size:18.0];
32 [menuButton.titleLabel setFont:expandedFont];
33 [menuButton.titleLabel setLineBreakMode:NSLineBreakByWordWrapping];
34 [menuButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
35 [menuButton.titleLabel setAdjustsFontSizeToFitWidth:YES];
38 CAGradientLayer *gradientLayer = [
self makeGradientLayer:NO];
39 [menuButton.layer addSublayer:gradientLayer];
◆ makeGradientLayer:()
+ (CAGradientLayer *) makeGradientLayer: |
|
(Boolean) |
status |
|
|
implementation |
Definition at line 69 of file Y3GradientButton.m.
72 CAGradientLayer *gradientLayer = [CAGradientLayer layer];
73 CGRect overFlowBounds =
menuButton.layer.bounds;
74 overFlowBounds.size.height -= 2.0;
75 gradientLayer.frame = overFlowBounds;
78 gradientLayer.colors = [NSArray arrayWithObjects:
79 (id)[UIColor colorWithWhite:0.4f alpha:0.5f].CGColor,
80 (id)[UIColor colorWithWhite:1.0f alpha:0.1f].CGColor,
83 gradientLayer.colors = [NSArray arrayWithObjects:
84 (id)[UIColor colorWithWhite:1.0f alpha:0.1f].CGColor,
85 (id)[UIColor colorWithWhite:0.4f alpha:0.5f].CGColor,
89 gradientLayer.locations = [NSArray arrayWithObjects:
90 [NSNumber numberWithFloat:0.0f],
91 [NSNumber numberWithFloat:1.0f],
94 gradientLayer.cornerRadius = 6;
◆ makeSingleCharacterGradientButton:withFrame:()
+ (Y3GradientButton *) makeSingleCharacterGradientButton: |
|
(NSString *) |
caption |
withFrame: |
|
(CGRect) |
menuButtonFrame |
|
|
| |
Definition at line 42 of file Y3GradientButton.m.
42 :(NSString *) caption withFrame: (CGRect) menuButtonFrame {
44 [menuButton setFrame:menuButtonFrame];
46 [menuButton setBackgroundColor:[UIColor colorWithHue:0.23 saturation:0.9 brightness:1.0 alpha:1.0]];
49 menuButton.layer.borderColor = [[UIColor blackColor] CGColor];
52 [menuButton setTitleEdgeInsets:UIEdgeInsetsMake(2, 2, 2, 2)];
53 [menuButton setTitle:caption forState:UIControlStateNormal];
54 [menuButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
55 [menuButton setTitleColor:[UIColor yellowColor] forState:UIControlStateSelected];
57 UIFont *expandedFont = [UIFont fontWithName:@"Verdana-Bold" size:40.0];
58 [menuButton.titleLabel setFont:expandedFont];
59 [menuButton.titleLabel setLineBreakMode:NSLineBreakByWordWrapping];
60 [menuButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
61 [menuButton.titleLabel setAdjustsFontSizeToFitWidth:YES];
64 CAGradientLayer *gradientLayer = [
self makeGradientLayer:NO];
65 [menuButton.layer addSublayer:gradientLayer];
◆ showDepressed:()
- (void) showDepressed: |
|
(Boolean) |
state |
|
Definition at line 99 of file Y3GradientButton.m.
101 NSLog(
@"GradientButton: showDepressed: %@", ( state ?
@"PUSHED" :
@"RELEASED"));
103 [
self.layer removeFromSuperlayer];
106 [
self.layer addSublayer:gradientLayer];
◆ showText:()
- (void) showText: |
|
(NSString *) |
caption |
|
Definition at line 110 of file Y3GradientButton.m.
110 :(NSString *) caption
112 [menuButton setTitle:caption forState:UIControlStateNormal];
113 [menuButton setNeedsDisplay];
The documentation for this class was generated from the following files: