-
Notifications
You must be signed in to change notification settings - Fork 131
/
TestViewController.m
94 lines (77 loc) · 3.54 KB
/
TestViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// TestViewController.m
// FancyBarButton
//
// Created by Sebastien Windal on 2/24/14.
// Copyright (c) 2014 Sebastien Windal. All rights reserved.
//
#import "TestViewController.h"
#import "FRDLivelyButton.h"
@interface TestViewController ()
@property (weak, nonatomic) IBOutlet FRDLivelyButton *bigButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *burgerButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *plustButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *plusCircleButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *closeButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *closeCircleButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *upCaretButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *downCaretButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *leftCaretButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *rightCaretButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *leftArrowButton;
@property (weak, nonatomic) IBOutlet FRDLivelyButton *rightArrowButton;
@end
@implementation TestViewController
{
kFRDLivelyButtonStyle newStyle;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.burgerButton setStyle:kFRDLivelyButtonStyleHamburger animated:NO];
[self.plusCircleButton setStyle:kFRDLivelyButtonStyleCirclePlus animated:NO];
[self.plustButton setStyle:kFRDLivelyButtonStylePlus animated:NO];
[self.closeButton setStyle:kFRDLivelyButtonStyleClose animated:NO];
[self.closeCircleButton setStyle:kFRDLivelyButtonStyleCircleClose animated:NO];
[self.upCaretButton setStyle:kFRDLivelyButtonStyleCaretUp animated:NO];
[self.downCaretButton setStyle:kFRDLivelyButtonStyleCaretDown animated:NO];
[self.leftCaretButton setStyle:kFRDLivelyButtonStyleCaretLeft animated:NO];
[self.rightCaretButton setStyle:kFRDLivelyButtonStyleCaretRight animated:NO];
[self.leftArrowButton setStyle:kFRDLivelyButtonStyleArrowLeft animated:NO];
[self.rightArrowButton setStyle:kFRDLivelyButtonStyleArrowRight animated:NO];
[self.bigButton setStyle:kFRDLivelyButtonStyleClose animated:YES];
[self.bigButton setOptions:@{kFRDLivelyButtonLineWidth: @(4.0f)}];
FRDLivelyButton *button = [[FRDLivelyButton alloc] initWithFrame:CGRectMake(0,0,36,28)];
[button setOptions:@{ kFRDLivelyButtonLineWidth: @(2.0f),
kFRDLivelyButtonHighlightedColor: [UIColor colorWithRed:0.5 green:0.8 blue:1.0 alpha:1.0],
kFRDLivelyButtonColor: [UIColor blueColor]
}];
[button setStyle:kFRDLivelyButtonStyleHamburger animated:NO];
[button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.rightBarButtonItem = buttonItem;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)changeButtonStyleAction:(FRDLivelyButton *)sender
{
[self.bigButton setStyle:sender.buttonStyle animated:YES];
}
- (IBAction)buttonAction:(FRDLivelyButton *)sender
{
newStyle = (newStyle + 1) % 11;
[sender setStyle:newStyle animated:YES];
}
@end