Skip to content

Commit

Permalink
Add offset property to change position of view. Closed #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Friend-LGA committed Jul 29, 2015
1 parent 980c21c commit a25a88e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LGPlusButtonsView.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'LGPlusButtonsView'
s.version = '1.0.2'
s.version = '1.0.3'
s.platform = :ios, '6.0'
s.license = 'MIT'
s.homepage = 'https://github.com/Friend-LGA/LGPlusButtonsView'
Expand Down
1 change: 1 addition & 0 deletions LGPlusButtonsView/LGPlusButtonsView.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ LGPlusButtonAnimationType;
@property (assign, nonatomic) CGSize plusButtonSize;
/** Description horizontal offset from button, default is 6.f */
@property (assign, nonatomic) CGFloat descriptionOffsetX;
@property (assign, nonatomic) CGPoint offset;

@property (assign, nonatomic) LGPlusButtonsAppearingAnimationType appearingAnimationType;
@property (assign, nonatomic) LGPlusButtonsAppearingAnimationType buttonsAppearingAnimationType;
Expand Down
12 changes: 12 additions & 0 deletions LGPlusButtonsView/LGPlusButtonsView.m
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,16 @@ - (void)setPosition:(LGPlusButtonsViewPosition)position
}
}

- (void)setOffset:(CGPoint)offset
{
if (!CGPointEqualToPoint(_offset, offset))
{
_offset = offset;

[self layoutInvalidate];
}
}

#pragma mark -

- (void)layoutInvalidate
Expand Down Expand Up @@ -677,6 +687,8 @@ - (void)layoutInvalidate
selfOrigin = CGPointMake(parentInset.left+parentOffset.x,
parentInset.top+parentOffset.y);
}
selfOrigin.x += _offset.x;
selfOrigin.y += _offset.y;

CGRect selfFrame = CGRectMake(selfOrigin.x, selfOrigin.y, selfSize.width, selfSize.height);
if ([UIScreen mainScreen].scale == 1.f) selfFrame = CGRectIntegral(selfFrame);
Expand Down

0 comments on commit a25a88e

Please sign in to comment.