Skip to content

Commit

Permalink
Merge pull request #131 from chrismiles/more-fixes-for-ios11
Browse files Browse the repository at this point in the history
More fixes for ios11
  • Loading branch information
kleinlieu authored Oct 22, 2017
2 parents 3963197 + a0feb86 commit 6d53b76
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ DerivedData
Pods/
._*
.DS_Store
*~
4 changes: 2 additions & 2 deletions CMPopTipView.podspec
Original file line number Diff line number Diff line change
@@ -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}"
Expand Down
32 changes: 9 additions & 23 deletions CMPopTipView/CMPopTipView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6d53b76

Please sign in to comment.