How to find the UI element connected to a specific IBOutlet?
Asked Answered
H

2

6

Is there any way to find which UI element an IBOutlet declared in code is connected to?

Hestia answered 21/11, 2014 at 8:15 Comment(0)
L
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.

enter image description here

Lysimeter answered 21/11, 2014 at 8:55 Comment(3)
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
M
1

You can search for the IBOutlet property name in the project directory. There you will find the corresponding xib file and UI element.

Memorable answered 16/3, 2021 at 18:50 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.