If you don't specify a delegate, is the
self the default delegate?
Also, if you have a
UITextField do you need to make sure it's knows it is a
UITextFieldDelegate or is it one by default?
If you don't specify a delegate,
Of what object? It is up to the implementation of the specific object to decide.
is the self the default delegate?
No, in the absence of any other information, the delegate would probably be nil.
However, if you were writing a class implementation, and wanted the object to set its delegate to
self by default, you could certainly do that. I think this would usually be more confusing than useful, though.
If you want to do something by default, just check if the delegate is nil. (Somebody could always set your delegate to be nil, so you have to do that check anyway.)
If you have a UITextField do you need to make sure it knows it is a UITextFieldDelegate or is it one by default?
UITextField does not implement any of the methods in
UITextFieldDelegate -- or at least it doesn't advertise that it does so -- so I'm not sure what you mean here. A
UITextField by itself cannot function as a
If you were to subclass
UITextField and add methods in the
UITextFieldDelegate protocol, then you could mark it as implementing
@interface MyTextField : UITextField <UITextFieldDelegate>
But that doesn't happen by default, you have to make it happen.