Is there any way to find which UI element an IBOutlet declared in code is connected to?
How to find the UI element connected to a specific IBOutlet?
Asked Answered
Go to your view controller file where you have declared IBOutlet
(.h or .m). Then you can see left side of each variable declaration there is a dark grey round image. (It is filled if you have connected that IBOutlet with Storyboard/Xib unless it is unfilled.)
By clicking that image you can see small popover which shows connection of outlet. See below image will show you.
Any idea why sometimes this works, sometimes it doesn't? Often I see empty circles for things I know are hooked up. Then if I open the storyboard, and go back to the source, the circles are sometimes now filled. –
Grantland
Yes, I see this too, Well I don't know may be its issue from Xcode or not. Well my guess would be indexing is not properly working, if you open Xcode and directly visit storyboard than you will find all circles are filled. –
Lysimeter
is there any way to do this in reverse? ie click on an element in the storyboard and somehow get a shortcut to the relevant viewController and line of code where that element is declared as either an iboutlet or inaction? –
Notepaper
You can search for the IBOutlet property name in the project directory. There you will find the corresponding xib file and UI element.
© 2022 - 2025 — McMap. All rights reserved.