From e72e395a8e82d641f517dacfe113362e34461fe2 Mon Sep 17 00:00:00 2001 From: Klein Lieu Date: Sun, 22 Oct 2017 16:21:41 -0700 Subject: [PATCH 1/3] better initialization of containerView --- CMPopTipView/CMPopTipView.m | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/CMPopTipView/CMPopTipView.m b/CMPopTipView/CMPopTipView.m index ee3f573..6e71775 100644 --- a/CMPopTipView/CMPopTipView.m +++ b/CMPopTipView/CMPopTipView.m @@ -616,29 +616,15 @@ - (void)presentPointingAtView:(UIView *)targetView inView:(UIView *)containerVie - (void)presentPointingAtBarButtonItem:(UIBarButtonItem *)barButtonItem animated:(BOOL)animated { UIView *targetView = (UIView *)[barButtonItem performSelector:@selector(view)]; + UIView *containerView = targetView.window; - // Try to find the superview of the UINavigationBar. Limit the number of tries to 8. - UIView *containerView = targetView.superview; - for(NSInteger i = 0; i < 8; ++i) { - if ([containerView isKindOfClass:[UIToolbar class]]) { - containerView = containerView.superview; - break; - } - - if([containerView isKindOfClass:[UINavigationBar class]]) { - containerView = containerView.superview; - break; - } - containerView = containerView.superview; + if (nil == containerView) { + NSLog(@"Cannot determine container view from UIBarButtonItem: %@", barButtonItem); + self.targetObject = nil; + return; } - if (nil == containerView) { - NSLog(@"Cannot determine container view from UIBarButtonItem: %@", barButtonItem); - self.targetObject = nil; - return; - } - - self.targetObject = barButtonItem; + self.targetObject = barButtonItem; [self presentPointingAtView:targetView inView:containerView animated:animated]; } From 7a2b3950e682b3adc441ae4ee02520b4317b2a83 Mon Sep 17 00:00:00 2001 From: Klein Lieu Date: Sun, 22 Oct 2017 16:23:47 -0700 Subject: [PATCH 2/3] adds fixes for ios 11 barbuttonitem issue --- .gitignore | 1 + CMPopTipView.podspec | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4eb9fe5..28f192f 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ DerivedData Pods/ ._* .DS_Store +*~ \ No newline at end of file diff --git a/CMPopTipView.podspec b/CMPopTipView.podspec index d45f50c..5677eb0 100755 --- a/CMPopTipView.podspec +++ b/CMPopTipView.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "CMPopTipView" - s.version = "2.3.0" + s.version = "2.3.1" s.summary = "Custom UIView for iOS that pops up an animated \"bubble\" pointing at a button or other view. Useful for popup tips." s.homepage = "https://github.com/chrismiles/CMPopTipView" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Chris Miles" => "http://chrismiles.info/" } - s.source = { :git => "https://github.com/chrismiles/CMPopTipView.git", :tag => "2.3.0" } + s.source = { :git => "https://github.com/chrismiles/CMPopTipView.git", :tag => "2.3.1" } s.platform = :ios, "6.0" s.requires_arc = true s.source_files = "CMPopTipView/*.{h,m}" From a0feb86c0bd7c8d18180e7d4d8c0c8da011d5951 Mon Sep 17 00:00:00 2001 From: Klein Lieu Date: Sun, 22 Oct 2017 16:24:40 -0700 Subject: [PATCH 3/3] fix indentation --- CMPopTipView/CMPopTipView.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMPopTipView/CMPopTipView.m b/CMPopTipView/CMPopTipView.m index 6e71775..9b601f9 100644 --- a/CMPopTipView/CMPopTipView.m +++ b/CMPopTipView/CMPopTipView.m @@ -615,9 +615,9 @@ - (void)presentPointingAtView:(UIView *)targetView inView:(UIView *)containerVie } - (void)presentPointingAtBarButtonItem:(UIBarButtonItem *)barButtonItem animated:(BOOL)animated { - UIView *targetView = (UIView *)[barButtonItem performSelector:@selector(view)]; + UIView *targetView = (UIView *)[barButtonItem performSelector:@selector(view)]; UIView *containerView = targetView.window; - + if (nil == containerView) { NSLog(@"Cannot determine container view from UIBarButtonItem: %@", barButtonItem); self.targetObject = nil; @@ -626,7 +626,7 @@ - (void)presentPointingAtBarButtonItem:(UIBarButtonItem *)barButtonItem animated self.targetObject = barButtonItem; - [self presentPointingAtView:targetView inView:containerView animated:animated]; + [self presentPointingAtView:targetView inView:containerView animated:animated]; } - (void)finaliseDismiss {