-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
I'd like to add a tooltip pointing to the right BarButton in the Navigation bar. I can't seem to figure out the right approach.
I've tried this but it doesn't work. I can't get a pointer to the host view. It seems the targetview is nil.
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self loadObjects];
UIBarButtonItem *rightBarButtonItem = self.navigationItem.rightBarButtonItem;
UIView *targetView = [self.navigationItem.rightBarButtonItem valueForKey:@"view"];
UIView *targetSuperview = [targetView superview];
UIView *containerView = [targetSuperview superview];
if (nil == containerView) {
NSLog(@"Cannot determine container view from UIBarButtonItem: %@", self.navigationItem.rightBarButtonItem);
return;
}
JDFTooltipView *tooltip = [[JDFTooltipView alloc] initWithTargetBarButtonItem:self.navigationItem.rightBarButtonItem hostView:containerView tooltipText:@"Right bar button" arrowDirection:JDFTooltipViewArrowDirectionDown width:200.0f];
[tooltip show];
}
So I tried a different way to get the view for UIBarButtonItem but again the targetview is nil.
UIView *targetView = (UIView *)[self.navigationItem.rightBarButtonItem performSelector:@selector(view)];
I even tried getting the view this way but no luck there either.
UIView* customview = [self.navigationItem.rightBarButtonItem customView];
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels