I’m a little confused about how things work in iOS development. I have a label in my storyboard that I want to access in my view Controller. Now, I imagine I’ll create an attribute and access the label. My question is how do I create the link between the view and the controller ? How do I specify that it is this particular label that I want to control if I have many already on the view in the storyboard.
Share
Try this:
Open your storyboard. Click on your ViewController. Now click on the middle icon on the top right of xcode that looks like a ‘face’ named Editor (with bow tie eyes). This should open up your ViewController’s .h file.
Now right click on your label, and the popup that opens up, click on the circle icon against ‘New Referencing Outlet’ and drag it to your .h file. This will create an IBOutlet pointing to your label, something like this:
Now, just use this as any other variable in your .m file, i.e
Hope that helps.