GeekedOut
GeekedOut

Reputation: 17185

iOS - why is there no property field created when I make a button in a storyboard?

I have a submit button that I made in my storyboard and connected to the .h of the corresponding controller.

What I need to do is shift a few elements up. For the elements that had properties I just did something like this:

CGPoint pt = test.center;
pt.y -= 60;
test.center = pt;

But the button didn't have a property created for it. Could someone please help me understand how to move a button and why there is no property automatically created for a button but there is one for all the other ui elements?

Thanks!

Upvotes: 0

Views: 18

Answers (1)

Chris Trahey
Chris Trahey

Reputation: 18290

You need to make two connections for a button, one for the action, one as an outlet. You select which one you are making in the little dialog that pops up:

select action or outlet

You can kinda think of them as inverses of each other. The action connection is the button pointing to your controller (same as passing a target/action to the button programmatically), and the outlet is your controller pointing to the button, so that it can manipulate it whenever it pleases.

Upvotes: 1

Related Questions