Open anuchandra opened 8 years ago
Is rightBarButtonItem
non-nil? Also, you'd want to pass your targetSuperview
for the tooltip's hostView
, not containerView
.
In any case, I've just found that tooltips seem to be positioning themselves incorrectly when using initWithTargetBarButtonItem:
, so it may be better to use one of the initWithTargetPoint:
methods instead (presumably using your view controller's view as the host view, and manually calculating a point to position it where you want it).
I'll investigate the issue with tooltips positioning incorrectly with initWithTargetBarButtonItem:
.
For some reason, the rightBarButtonItem is non-nil but targetView, targetSuperview, containerView are nil.
initWithTargetPoint works reasonably OK. The slight issue is that the arrow doesn't quite point to the rightbarbuttonitem. Never the less, its a big step forward. The new app version 1.2 using your tooltips will be in App Store in a few days so you can see them in real use.
https://itunes.apple.com/gb/app/tread-light/id1071002773?mt=8
Strange - perhaps because you're doing it in viewWillAppear:
?
Have you tried adjusting the point you supply to get it to point where you want? Or is it as close to the edge of the screen as it'll go?
Cool - let me know when it's live and I'll take a look!
I had the same issue with viewDidLoad and viewDidAppear. I'll try adjusting the point for the next app release. For now the new version 1.2 has a slightly mispointed arrow. I'll let you know when 1.2 is in the App Store.
Cool - thanks.
Hello, the app and your code is live. Sorry for the delay in getting back to you. https://itunes.apple.com/gb/app/tread-light/id1071002773?mt=8
Oh, no problem at all - I just though it would be interesting to see :)
Thanks for letting me know - I'll take a look
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.
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];