How to connect Interface Builder elements to Xcode variables?
I am extremely new to iPhone development and am trying to make a Tab Bar Application in Xcode.
My understanding is that it should work like this:
- Create Tab Bar Application
- Add variables to view (ie FirstViewController.h)
- Add element in Instance Builder
- Draw line from New Referencing Outlet to File's Owner, and the variable should pop up.
The last step is where I have a problem, when I make a line to File's Owner the only thing that shows up is 'view'. None of my variables show up there. Any thoughts?
S开发者_运维百科pecifically, I'm trying to make a slider and a label that shows the slider's value on change. I know that to do this I will need a slider, label, and function to handle the ValueChanged event. I can create the variables and UI elements, but I can't seem to link them.
When you declare your variables in your interface, you need to declare them as (IBOutlet)
:
UILabel IBOutlet *myLabel;
The question and answers here have more information.
uilabel must be like below
UILabel IBOutlet *myLabel;
精彩评论