13 #pragma mark - Accessories 16 + (
Y3GradientButton *)makeGradientButton:(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];
39 [menuButton.layer addSublayer:gradientLayer];
42 + (
Y3GradientButton *)makeSingleCharacterGradientButton:(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];
65 [menuButton.layer addSublayer:gradientLayer];
69 + (CAGradientLayer *) makeGradientLayer:(Boolean) status
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;
99 -(void)showDepressed:(Boolean)state
101 NSLog(
@"GradientButton: showDepressed: %@", ( state ?
@"PUSHED" :
@"RELEASED"));
103 [
self.layer removeFromSuperlayer];
106 [
self.layer addSublayer:gradientLayer];
110 - (void) showText:(NSString *) caption
112 [menuButton setTitle:caption forState:UIControlStateNormal];
113 [menuButton setNeedsDisplay];