Reputation: 11
I am newb. Every one is talking about delegates.Yes, It is powerful but always I ask my self a question : "How do we know any class in ios SDK has a delegate?" which gives more functionality. For example, we use UITextField/UIAlertview several times and it took me some time to know that it has a delegate and gives some more functionality. I knew this,what if I don`t know that it has a delegate and limit my self to use Alertview functionality without knowing its delegate methods. Any one can please through some light on it ? how do I know any xxxclass has a delegate? Thanks in advance!
Upvotes: 0
Views: 193
Reputation: 27506
Alt-click on the class name in your code and you will see some documentation.
Then you can click on the link to the class reference or on the book icon to get the reference of the class.
So whenever you have a doubt about a class, your first reflex should be to have a look at the documentation.
Upvotes: 1
Reputation: 10251
Whenever you use a API class, see the header file. It has all the information you need regarding the API. Suppose if you want to know more about UITextfield look at UITextfield.h.
Upvotes: 1
Reputation: 16296
Apple's documentation is generally very good at explaining this kind of thing.
If you hold the option (alt) key and click on the class name in your code, XCode will pop up a mini documentation widget, and you can click on the Reference link to get to the full documentation page for that class. The Overview section will cover what delegates, notifications etc are available.
Upvotes: 1
Reputation: 5112
If you weren't sure, you can look in the class reference file. If the class has a delegate property, you can be sure you can be the delegate of the class. For example.
Hope this helps.
Upvotes: 1
Reputation: 7450
Declare a variable and then see if it has a delegate
property or a setDelegate:
method. Example:
UITextField *testTextField = [[UITextField alloc]init];
testTextField.delegate = self;
If it doesn't have a delegate it will give you an error.
Hope it helps
Upvotes: 0