Is there any way to find which UI element an IBOutlet declared in code is connected to?
Asked
Active
Viewed 3,966 times
2 Answers
13
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.

Kampai
- 22,848
- 21
- 95
- 95
-
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. – occulus Dec 12 '17 at 14:37
-
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. – Kampai Dec 13 '17 at 07:10
-
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? – lozflan Apr 05 '18 at 07:23
1
You can search for the IBOutlet property name in the project directory. There you will find the corresponding xib file and UI element.

ManishNC
- 11
- 2