0

I have an array of navigation items. I am trying to add a popover near one of the navigation items. I am not using CustomView in the button

navigationItem.rightBarButtonItems = [infoBarButtonItem, aboutBarButtonItem]

let barButtonView = navigationItem.rightBarButtonItems?.first

How can I get the CGPoints of barButtonView?

achu
  • 329
  • 3
  • 7

1 Answers1

0

I think you're trying to get at private data. Before iOS 11, it's possible to get the view of UIBarButtonItem with value(forKey:) func but it no longer gives you the view. As far as I know, the only way is to make a bar button item with a custom view and just keep a reference to that custom view so you can get its position later. There's also a similar thread on the Apple developer forum so I'll attach the link in case you're curious. Apple Developer Forum Thread There was also a similar question on StackOverflow nine years ago.Old StackOverflow question

KyawTheMonkey
  • 181
  • 1
  • 6