"Hello world" app...some questions

Joined
Aug 22, 2012
Messages
5
Reaction score
0
Points
1
Location
Northern VA
Your Mac's Specs
Macbook Pro 2012 13" 2.9gz, 8gb ram, 750gb hd
I finally got my "hello world" app to work and I have some questions.
First, one thing that kept getting messed up for me was the connections. It seems the only way to fix it is to delete and replace the UI item if it's connections are not configured correctly. I tried messing with the xml file where the connection info is stored but that didn't work at all. Is there an easier way to edit this stuff if the cntrl - mouse from ui object to .h or .m file isn't working (because there's already a messed up situation.)
Second, what determines which UI items need to be delegates. For example, in this case the button was clearly an action so it wouldn't be a delegate. The field where you typed was a delegate but what about the label that is going to be changed based on what is in the text field?

As you can see this whole GUI concept of making connections is still a bit confusing...maybe it's just the way the GUI presents it. I understand all the items have to have a connection to the view controller it just seems awkward the way they make you do it.

Thanks!
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
UI Elements will never be delegates, they will HAVE delegates.

UI Elements can either be Actions, Outlets or BOTH. A button will normally have a IBAction (a method) associated with it. A button can also have an IBOutlet (a instance variable, AKA IVAR) associated with it should the developer want quick access to the button within the code. UILabels will have an IBOutlet associated with it.

Any time you need to modify an element in the UI (and you don't want to go through finding the element yourself, which can also be done) you would associate that element with an IBOutlet.

Any time an element will need to send a message to have some operation performed (buttons, sliders, etc.) they will need to have an IBAction associated with it.

If you screw up a UI element using the assistant within XCode, you can just delete all of the associated code and select the specific object (like a button), go to it's connections panel (on the right side, or right click on the element) and tick the x on the associated connection that is wrong.
 
OP
C
Joined
Aug 22, 2012
Messages
5
Reaction score
0
Points
1
Location
Northern VA
Your Mac's Specs
Macbook Pro 2012 13" 2.9gz, 8gb ram, 750gb hd
Thank you for the detailed response...it will be helpful!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top