diff --git a/CMPopTipView/CMPopTipView.h b/CMPopTipView/CMPopTipView.h index 4385968..488eec8 100644 --- a/CMPopTipView/CMPopTipView.h +++ b/CMPopTipView/CMPopTipView.h @@ -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; diff --git a/CMPopTipView/CMPopTipView.m b/CMPopTipView/CMPopTipView.m index 4930799..ee3f573 100644 --- a/CMPopTipView/CMPopTipView.m +++ b/CMPopTipView/CMPopTipView.m @@ -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) { diff --git a/README.md b/README.md index d2e6433..b19938e 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ Available Options * **CGFloat** maxWidth * **PointDirection** preferredPointDirection * **BOOL** hasGradientBackground +* **BOOL** showFromCenter * **CGFloat** sidePadding * **CGFloat** topMargin * **CGFloat** pointerSize