Connecting The Delegate Property To The File's Owner


#1

I’m hoping someone can clarify this for me. This refers to page 201, at the bottom, where we are control-dragging from each UITextField to the File’s Owner and selecting delegate from the list. From what I remember from the earlier chapters this is the first time they are having us do this. I understand what a delegate is but am fuzzy on what exactly this step is enabling us to do and why it is required.

Thanks in advance for any tips!


#2

By doing that you are telling the UITextField object what its delegate is. The delegate will be the instance of the File’s Owner class, which should adopt the protocol(s) required by the UITextField. If the UITextField has a delegate, then it can communicate with the delegate to customise its behaviour.


#3

The above comment is correct. To add to this discussion, I also want to point out that you did this same thing in the Delegation chapter on page 147, except you did it programmatically there whereas you are making that connection in Interface Builder here.


#4

ahhh ok, now I got it. Thanks for the explanations. Also, thanks for the pg. 147 reference. I didn’t put the connection together.


#5

I confess I had difficulty with this step. I was attempting to control-drag from the xib view to the File’s Owner and nothing was happening. I had to switch to outline view and from there, control-drag the text field atop the File’s Owner. Then I would see the delegate popup.