From c553af12a926e034c6e57c96ab93d8c4f516f1bc Mon Sep 17 00:00:00 2001 From: Jake Lisby Date: Mon, 20 Apr 2015 09:27:20 -0500 Subject: [PATCH] Adding buttonMenuChatType for showing chats available --- .../VBFPopFlatButton.h | 3 +- .../VBFPopFlatButton.m | 34 +++++++++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.h b/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.h index 11ba2d7..2f9b856 100755 --- a/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.h +++ b/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.h @@ -32,6 +32,7 @@ typedef NS_ENUM(NSInteger, FlatButtonType) { buttonRewindType, buttonFastForwardType, buttonSquareType, + buttonMenuChatType, }; typedef NS_ENUM(NSInteger, FlatButtonStyle) { @@ -68,4 +69,4 @@ typedef NS_ENUM(NSInteger, FlatButtonStyle) { - (UIColor *)tintColorForState:(UIControlState)state; - (void)animateToType:(FlatButtonType)finalType; -@end +@end \ No newline at end of file diff --git a/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.m b/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.m index f607c05..24fc122 100755 --- a/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.m +++ b/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.m @@ -16,6 +16,7 @@ @interface VBFPopFlatButton () { @property (nonatomic, strong) VBFDoubleSegment *firstSegment; @property (nonatomic, strong) VBFDoubleSegment *secondSegment; @property (nonatomic, strong) VBFDoubleSegment *thirdSegment; //Only used for menu button +@property (nonatomic, strong) VBFDoubleSegment *fourthSegment; @property (nonatomic, strong) CALayer *bckgLayer; @property (nonatomic) BOOL animateToStartPosition; @end @@ -79,6 +80,10 @@ - (void) commonSetup { _thirdSegment.opacity = 0.0; [self.layer addSublayer:_thirdSegment]; + _fourthSegment = [[VBFDoubleSegment alloc]initWithLength:self.frame.size.width/2 thickness:self.frame.size.width/2 radius:50 color:[UIColor colorWithRed:0.971622 green:0.0655261 blue:0.316449 alpha:1] initialState:doubleSegmentMinusState]; + _fourthSegment.opacity = 0.0; + [self.layer addSublayer:_fourthSegment]; + if (self.currentButtonStyle == buttonRoundedStyle) { [self setupBackgroundLayer]; } @@ -92,7 +97,7 @@ - (void)setupBackgroundLayer { self.bckgLayer.frame = CGRectInset(self.bounds, -amount, -amount); self.bckgLayer.cornerRadius = self.bckgLayer.bounds.size.width/2; self.bckgLayer.backgroundColor = self.roundBackgroundColor.CGColor; - + [self.layer insertSublayer:self.bckgLayer below:_firstSegment]; } @@ -192,10 +197,12 @@ - (void)animateToType:(FlatButtonType)finalType { self.firstSegment.opacity = 1.0f; self.secondSegment.opacity = 1.0f; self.thirdSegment.opacity = 0.0f; + self.fourthSegment.opacity = 0.0f; CGPoint firstOriginPoint = CGPointMake(CGRectGetWidth(self.frame)/2, CGRectGetHeight(self.frame)/2); CGPoint secondOriginPoint = firstOriginPoint; CGPoint thirdOriginPoint = firstOriginPoint; + CGPoint fourthOriginPoint = firstOriginPoint; switch (finalType) { case buttonAddType: @@ -262,7 +269,7 @@ - (void)animateToType:(FlatButtonType)finalType { [self.firstSegment moveToState:doubleSegmentDownArrow animated:self.animateToStartPosition]; [self.secondSegment moveToState:doubleSegmentDownArrow animated:self.animateToStartPosition]; self.secondSegment.opacity = 0.0; - + firstOriginPoint.y += CGRectGetHeight(self.firstSegment.frame)/5; break; case buttonDownArrowType: @@ -274,7 +281,7 @@ - (void)animateToType:(FlatButtonType)finalType { [self.firstSegment moveToState:doubleSegmentUpArrow animated:self.animateToStartPosition]; [self.secondSegment moveToState:doubleSegmentUpArrow animated:self.animateToStartPosition]; self.secondSegment.opacity = 0.0; - + firstOriginPoint.y -= CGRectGetHeight(self.firstSegment.frame)/5; break; case buttonPausedType: @@ -359,8 +366,21 @@ - (void)animateToType:(FlatButtonType)finalType { firstOriginPoint.x -= offsetAmount; secondOriginPoint.x += offsetAmount; break; - - + case buttonMenuChatType: + self.thirdSegment.opacity = 1.0; + [self.firstSegment moveToState:doubleSegmentMinusState animated:self.animateToStartPosition]; + [self.secondSegment moveToState:doubleSegmentMinusState animated:self.animateToStartPosition]; + [self.thirdSegment moveToState:doubleSegmentMinusState animated:self.animateToStartPosition]; + [self.fourthSegment moveToState:doubleSegmentMinusState animated:self.animateToStartPosition]; + + CGFloat verticalChatAmount = CGRectGetHeight(self.frame)/3; + fourthOriginPoint.y = self.frame.size.width/4; + fourthOriginPoint.x = self.frame.size.width/4*3; + thirdOriginPoint.y -= verticalChatAmount; + secondOriginPoint.y += verticalChatAmount; + self.fourthSegment.opacity = 1.0; + break; + default: break; } @@ -368,7 +388,7 @@ - (void)animateToType:(FlatButtonType)finalType { [self.firstSegment movePositionToPoint:firstOriginPoint animated:self.animateToStartPosition]; [self.secondSegment movePositionToPoint:secondOriginPoint animated:self.animateToStartPosition]; [self.thirdSegment movePositionToPoint:thirdOriginPoint animated:self.animateToStartPosition]; - + [self.fourthSegment movePositionToPoint:fourthOriginPoint animated:self.animateToStartPosition]; if (!self.animateToStartPosition) { //Setting that line makes sure the above code is only NOT animated first time self.animateToStartPosition = YES; @@ -392,4 +412,4 @@ - (UIColor *)linesColor { return self.tintColor; } -@end +@end \ No newline at end of file