From d3f1b2387a71f56d61d8771201ecee8aea94335c Mon Sep 17 00:00:00 2001 From: Anton Plebanovich Date: Wed, 31 May 2017 00:11:28 +0300 Subject: [PATCH 1/2] - Show from center bool --- CMPopTipView/CMPopTipView.h | 1 + CMPopTipView/CMPopTipView.m | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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 dbb0ef3..65283c1 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) { From e25d803d6f8c05252859dcf91238e1d1e7d7cb73 Mon Sep 17 00:00:00 2001 From: Anton Plebanovich Date: Thu, 24 Aug 2017 11:34:44 +0300 Subject: [PATCH 2/2] - Add available option to README section --- README.md | 1 + 1 file changed, 1 insertion(+) 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