Cannot connect \ label button with \ outlet variable in storyboard

I created 2 View Controllers: when you first create a button, when you click on it, you will open another View controller with a button and a label. I already created an output and a variable for them.

My question is: when I try to connect the \ label button with the \ outlet variable, I don’t see the selection around the \ label button → I mean that I can’t connect the mall. Why?

PS DO NOT FIND THE MINUS I AM ONLY A NEW PROGRAM!

+7
source share
3 answers

Can you post your IBOutlet ads? You must declare the UIButtons in such a way as to make them work (connect) in Interface Builder:

@property (nonatomic, strong) IBOutlet UIButton *aButton; 

For a label, this is the same:

 @property (nonatomic, strong) IBOutlet UILabel *aLabel; 

I think you either forgot to write IBOutlet, or the wrong variable type.

+2
source

Ok! I solved this problem.

I just needed to create a new Objective-C class , select this new class in the Identity Inspector of the second View Controller and write all the code in this new class.

0
source

I missed that too.

For everyone who is still confused, select "View Controller" (yellow box) on your storyboard, and then under the inspector select enter image description here Identity Inspector. See Images.

Now you can include the IBOutlet elements in the .h file. interface.

enter image description here

enter image description here

0
source

All Articles