0

I'm a newbie and am learning the iOS-dev through reading the official tutorial Your First iOS App .

While I don't quite understand the behind meaning of control-dragging the text-filed into the view controller represented by a yellow sphere icon.

I mean it's easy to follow but hard to know the behind reason.

I checked the code after the operation and found nothing is added.

Could someone help to figure out why? TIA.


well, I posted some description the tutorial says to help my question could be understood exactly.

"In the view, Control-drag from the text field to the yellow sphere in the scene dock (the yellow sphere represents the view controller object). When you release the Control-drag, you should see something like this: [sorry image's not allowed to upload for now]. Select delegate in the Outlets section of the translucent panel that appears."

lookof
  • 363
  • 1
  • 3
  • 8
  • It's too hard for us too understand your issue. – rishi May 16 '12 at 08:17
  • yep. if I can post an image that would be easy to describe my issue but I'm not allowed to do that as a new guy here. alas.. – lookof May 16 '12 at 08:21
  • you can have image at any location, just paste a link here, I think that is easy for you. – rishi May 16 '12 at 08:23
  • watever changes u make to the interface builder file(called .xib) wont be reflected in the code.Whenever the viewcontroller is initialised with nib it reads its xib file and displays the view accordingly. – sujith1406 May 16 '12 at 08:35
  • Thanks rishi, really. But I think I found the answer, just in the tutorial itself. It's my fault to read it carelessly. Sorry to waste your time~ – lookof May 16 '12 at 08:38

2 Answers2

0

The best way to think about it is, that what you create in Interface Builder has to be linked to your code. A .xib file is really just a complicated XML document. By linking the .xib to the controller it will write code in the XML linking it to the code. otherwise when the .xib and your source code is compiled, the compiler won't link the two entities.

Hope this helps

geminiCoder
  • 2,918
  • 2
  • 29
  • 50
0

By control-dragging, we create connections between objects/views in the nib (.xib) file to an action (IBAction) or an outlet (IBOutlet) in View Controller.

Nib files (.xib) has responsibility to establish all connections (actions and outlets). There will be nothing added to your Controller code to reflect the connections.

Anwar Chandra
  • 8,538
  • 9
  • 45
  • 61