Skip to content

Commit

Permalink
Merge pull request #126 from anton-plebanovich/feature/show-from-center
Browse files Browse the repository at this point in the history
- Show from center bool
  • Loading branch information
kleinlieu authored Oct 22, 2017
2 parents c403ec6 + e25d803 commit 3963197
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMPopTipView/CMPopTipView.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ typedef NS_ENUM(NSInteger, CMPopTipAnimation) {
@property (nonatomic, assign) CGFloat maxWidth;
@property (nonatomic, assign) PointDirection preferredPointDirection;
@property (nonatomic, assign) BOOL hasGradientBackground;
@property (nonatomic, assign) BOOL showFromCenter;
@property (nonatomic, assign) CGFloat sidePadding;
@property (nonatomic, assign) CGFloat topMargin;
@property (nonatomic, assign) CGFloat pointerSize;
Expand Down
3 changes: 2 additions & 1 deletion CMPopTipView/CMPopTipView.m
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ - (void)presentPointingAtView:(UIView *)targetView inView:(UIView *)containerVie
}
else {
_pointDirection = _preferredPointDirection;
CGPoint targetOriginInContainer = [targetView convertPoint:CGPointMake(0.0, 0.0) toView:containerView];
CGPoint showPoint = self.showFromCenter ? CGPointMake(targetView.bounds.size.width/2, targetView.bounds.size.height/2) : CGPointMake(0.0, 0.0);
CGPoint targetOriginInContainer = [targetView convertPoint:showPoint toView:containerView];
CGFloat sizeBelow = containerView.bounds.size.height - targetOriginInContainer.y;
if (_pointDirection == PointDirectionAny) {
if (sizeBelow > targetOriginInContainer.y) {
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Available Options
* **CGFloat** maxWidth
* **PointDirection** preferredPointDirection
* **BOOL** hasGradientBackground
* **BOOL** showFromCenter
* **CGFloat** sidePadding
* **CGFloat** topMargin
* **CGFloat** pointerSize
Expand Down

0 comments on commit 3963197

Please sign in to comment.