0

I have created in storyboard, a navigation bar with 3 left bar buttons enter image description here

and each bar button has its own IBOutlet variable. Is there a way to access each one and get its coordinates in the navigation bar? I am just looking for the lower left and right XY values.

I have in code the following line

print("bbtnFindMyPics frame size: \(bbtnFindMyPics.accessibilityFrame.size)")

but I get the values (0.0, 0.0).

Any help is appreciated. Thank you.

sugarakis
  • 117
  • 9
  • 1
    Have you check this: https://stackoverflow.com/questions/28991100/get-the-frame-of-uibarbuttonitem-in-swift – Faysal Ahmed Feb 17 '21 at 04:03
  • @Faysal Ahmed: Thank you for the msg. It did work a bit, by giving me some insight. The last line of code "var buttonItemSize = buttonItemView?.size" does not work with Swift 5 anymore and it has to be changed to "var buttonItemSize = buttonItemView?.frame.size". However this solution only gives the first barbuttonitem. I need to figure out how to loop through all the left hand side NavigationBar barbuttonitems. – sugarakis Feb 17 '21 at 05:30

0 Answers0