开发者

How to connect Interface Builder elements to Xcode variables?

开发者 https://www.devze.com 2023-03-19 10:02 出处:网络
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:

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:

  1. Create Tab Bar Application
  2. Add variables to view (ie FirstViewController.h)
  3. Add element in Instance Builder
  4. 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;
0

精彩评论

暂无评论...
验证码 换一张
取 消