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}" diff --git a/CMPopTipView/CMPopTipView.m b/CMPopTipView/CMPopTipView.m index ee3f573..9b601f9 100644 --- a/CMPopTipView/CMPopTipView.m +++ b/CMPopTipView/CMPopTipView.m @@ -615,32 +615,18 @@ - (void)presentPointingAtView:(UIView *)targetView inView:(UIView *)containerVie } - (void)presentPointingAtBarButtonItem:(UIBarButtonItem *)barButtonItem animated:(BOOL)animated { - UIView *targetView = (UIView *)[barButtonItem performSelector:@selector(view)]; - - // 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; - } + 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; - 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]; + [self presentPointingAtView:targetView inView:containerView animated:animated]; } - (void)finaliseDismiss {