diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f2a21a1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+
+FRDLivelyButtonDemo/FRDLivelyButtonDemo.xcodeproj/project.xcworkspace/xcshareddata/FRDLivelyButtonDemo.xccheckout
+
+FRDLivelyButtonDemo/FRDLivelyButtonDemo.xcodeproj/project.xcworkspace/xcuserdata/sebastienwindal.xcuserdatad/WorkspaceSettings.xcsettings
+
+FRDLivelyButtonDemo/FRDLivelyButtonDemo.xcodeproj/project.xcworkspace/xcuserdata/sebastienwindal.xcuserdatad/UserInterfaceState.xcuserstate
+
+*.xcuserstate
diff --git a/FRDLivelyButton.podspec b/FRDLivelyButton.podspec
index da61e86..418e2d2 100644
--- a/FRDLivelyButton.podspec
+++ b/FRDLivelyButton.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "FRDLivelyButton"
- s.version = "1.0.1"
+ s.version = "1.1.0"
s.summary = "Lively button."
s.description = "Simple UIButton subclass intended to be used inside a UIBarButtonItem. Supports common nav bar button types, nicely animates button type changes and touch events."
s.homepage = "http://github.com/sebastienwindal/FRDLivelyButton"
diff --git a/FRDLivelyButtonDemo/FRDLivelyButtonDemo.xcodeproj/project.xcworkspace/xcuserdata/sebastienwindal.xcuserdatad/UserInterfaceState.xcuserstate b/FRDLivelyButtonDemo/FRDLivelyButtonDemo.xcodeproj/project.xcworkspace/xcuserdata/sebastienwindal.xcuserdatad/UserInterfaceState.xcuserstate
index 14214b6..21a472a 100644
Binary files a/FRDLivelyButtonDemo/FRDLivelyButtonDemo.xcodeproj/project.xcworkspace/xcuserdata/sebastienwindal.xcuserdatad/UserInterfaceState.xcuserstate and b/FRDLivelyButtonDemo/FRDLivelyButtonDemo.xcodeproj/project.xcworkspace/xcuserdata/sebastienwindal.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/FRDLivelyButtonDemo/FRDLivelyButtonDemo/FRDLivelyButton.h b/FRDLivelyButtonDemo/FRDLivelyButtonDemo/FRDLivelyButton.h
index 149595f..7f32839 100644
--- a/FRDLivelyButtonDemo/FRDLivelyButtonDemo/FRDLivelyButton.h
+++ b/FRDLivelyButtonDemo/FRDLivelyButtonDemo/FRDLivelyButton.h
@@ -16,7 +16,11 @@ typedef enum {
kFRDLivelyButtonStyleCirclePlus,
kFRDLivelyButtonStyleCircleClose,
kFRDLivelyButtonStyleCaretUp,
- kFRDLivelyButtonStyleCaretDown
+ kFRDLivelyButtonStyleCaretDown,
+ kFRDLivelyButtonStyleCaretLeft,
+ kFRDLivelyButtonStyleCaretRight,
+ kFRDLivelyButtonStyleArrowLeft,
+ kFRDLivelyButtonStyleArrowRight
} kFRDLivelyButtonStyle;
@interface FRDLivelyButton : UIButton
diff --git a/FRDLivelyButtonDemo/FRDLivelyButtonDemo/FRDLivelyButton.m b/FRDLivelyButtonDemo/FRDLivelyButtonDemo/FRDLivelyButton.m
index 635bf4f..f498de7 100644
--- a/FRDLivelyButtonDemo/FRDLivelyButtonDemo/FRDLivelyButton.m
+++ b/FRDLivelyButtonDemo/FRDLivelyButtonDemo/FRDLivelyButton.m
@@ -179,6 +179,16 @@ -(CGPathRef) createCenteredLineWithRadius:(CGFloat)radius angle:(CGFloat)angle o
return path;
}
+-(CGPathRef) createLineFromPoint:(CGPoint)p1 toPoint:(CGPoint)p2
+{
+ CGMutablePathRef path = CGPathCreateMutable();
+
+ CGPathMoveToPoint(path, NULL, self.offset.x + p1.x, self.offset.y + p1.y);
+ CGPathAddLineToPoint(path, NULL, self.offset.x + p2.x, self.offset.y + p2.y);
+
+ return path;
+}
+
-(void) setStyle:(kFRDLivelyButtonStyle)style animated:(BOOL)animated
{
self.buttonStyle = style;
@@ -247,6 +257,38 @@ -(void) setStyle:(kFRDLivelyButtonStyle)style animated:(BOOL)animated
newLine1Alpha = 0.0f;
newLine2Path = [self createCenteredLineWithRadius:self.dimension/4.0f - self.line2Layer.lineWidth/2.0f angle:M_PI_4 offset:CGPointMake(self.dimension/6.0f,0.0f)];
newLine3Path = [self createCenteredLineWithRadius:self.dimension/4.0f - self.line3Layer.lineWidth/2.0f angle:3*M_PI_4 offset:CGPointMake(-self.dimension/6.0f,0.0f)];
+ } else if (style == kFRDLivelyButtonStyleCaretLeft) {
+ newCirclePath = [self createCenteredCircleWithRadius:self.dimension/20.0f];
+ newCircleAlpha = 0.0f;
+ newLine1Path = [self createCenteredLineWithRadius:self.dimension/20.0f angle:0 offset:CGPointMake(0, 0)];
+ newLine1Alpha = 0.0f;
+ newLine2Path = [self createCenteredLineWithRadius:self.dimension/4.0f - self.line2Layer.lineWidth/2.0f angle:-3*M_PI_4 offset:CGPointMake(0.0f,self.dimension/6.0f)];
+ newLine3Path = [self createCenteredLineWithRadius:self.dimension/4.0f - self.line3Layer.lineWidth/2.0f angle:3*M_PI_4 offset:CGPointMake(0.0f,-self.dimension/6.0f)];
+ } else if (style == kFRDLivelyButtonStyleCaretRight) {
+ newCirclePath = [self createCenteredCircleWithRadius:self.dimension/20.0f];
+ newCircleAlpha = 0.0f;
+ newLine1Path = [self createCenteredLineWithRadius:self.dimension/20.0f angle:0 offset:CGPointMake(0, 0)];
+ newLine1Alpha = 0.0f;
+ newLine2Path = [self createCenteredLineWithRadius:self.dimension/4.0f - self.line2Layer.lineWidth/2.0f angle:-M_PI_4 offset:CGPointMake(0.0f,self.dimension/6.0f)];
+ newLine3Path = [self createCenteredLineWithRadius:self.dimension/4.0f - self.line3Layer.lineWidth/2.0f angle:M_PI_4 offset:CGPointMake(0.0f,-self.dimension/6.0f)];
+ } else if (style == kFRDLivelyButtonStyleArrowLeft) {
+ newCirclePath = [self createCenteredCircleWithRadius:self.dimension/20.0f];
+ newCircleAlpha = 0.0f;
+ newLine1Path = [self createCenteredLineWithRadius:self.dimension/2.0f angle:M_PI offset:CGPointMake(0, 0)];
+ newLine1Alpha = 1.0f;
+ newLine2Path = [self createLineFromPoint:CGPointMake(0, self.dimension/2.0f)
+ toPoint:CGPointMake(self.dimension/2.0f/GOLDEN_RATIO, self.dimension/2+self.dimension/2.0f/GOLDEN_RATIO)];
+ newLine3Path = [self createLineFromPoint:CGPointMake(0, self.dimension/2.0f)
+ toPoint:CGPointMake(self.dimension/2.0f/GOLDEN_RATIO, self.dimension/2-self.dimension/2.0f/GOLDEN_RATIO)];
+ } else if (style == kFRDLivelyButtonStyleArrowRight) {
+ newCirclePath = [self createCenteredCircleWithRadius:self.dimension/20.0f];
+ newCircleAlpha = 0.0f;
+ newLine1Path = [self createCenteredLineWithRadius:self.dimension/2.0f angle:0 offset:CGPointMake(0, 0)];
+ newLine1Alpha = 1.0f;
+ newLine2Path = [self createLineFromPoint:CGPointMake(self.dimension, self.dimension/2.0f)
+ toPoint:CGPointMake(self.dimension - self.dimension/2.0f/GOLDEN_RATIO, self.dimension/2+self.dimension/2.0f/GOLDEN_RATIO)];
+ newLine3Path = [self createLineFromPoint:CGPointMake(self.dimension, self.dimension/2.0f)
+ toPoint:CGPointMake(self.dimension - self.dimension/2.0f/GOLDEN_RATIO, self.dimension/2-self.dimension/2.0f/GOLDEN_RATIO)];
} else {
NSAssert(FALSE, @"unknown type");
}
diff --git a/FRDLivelyButtonDemo/FRDLivelyButtonDemo/Storyboard.storyboard b/FRDLivelyButtonDemo/FRDLivelyButtonDemo/Storyboard.storyboard
index cb332a7..3787032 100644
--- a/FRDLivelyButtonDemo/FRDLivelyButtonDemo/Storyboard.storyboard
+++ b/FRDLivelyButtonDemo/FRDLivelyButtonDemo/Storyboard.storyboard
@@ -18,7 +18,7 @@
+
+
+
+
@@ -111,8 +151,12 @@
+
+
+
+
diff --git a/FRDLivelyButtonDemo/FRDLivelyButtonDemo/TestViewController.m b/FRDLivelyButtonDemo/FRDLivelyButtonDemo/TestViewController.m
index 75eb75a..f86d162 100644
--- a/FRDLivelyButtonDemo/FRDLivelyButtonDemo/TestViewController.m
+++ b/FRDLivelyButtonDemo/FRDLivelyButtonDemo/TestViewController.m
@@ -20,6 +20,10 @@ @interface TestViewController ()
@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
@@ -49,6 +53,10 @@ - (void)viewDidLoad
[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)}];
@@ -78,7 +86,7 @@ - (IBAction)changeButtonStyleAction:(FRDLivelyButton *)sender
- (IBAction)buttonAction:(FRDLivelyButton *)sender
{
- newStyle = (newStyle + 1) % 7;
+ newStyle = (newStyle + 1) % 11;
[sender setStyle:newStyle animated:YES];
}