iphone - What exactly does "adopt a protocol" mean in the Objective-C / Cocoa documentation? -


I'm starting on a C # developer objective c / coco touch programming. I think some words have been considered wrong because I am thinking about them "C # way", in particular, I have come across the various protocols and tutorials "Protocol".

In Objective-C, what is actually a protocol? Can it be compared to the C # interface?

Is the following announcement only "Implementing the Class Protocol UITextFieldDelegate"? Or is UITextFieldDelegate to compare with a normal type parameter in C #?

@interface MyViewController: UIViewController & lt; UITextFieldDelegate & gt; Objective - The name for the collection of one protocol selectors in C / {}

  @interface MyViewController: UIViewController & lt; UITextFieldDelegate & gt; {}  

means that the class receives MyViewController from the class UIViewController and implements the protocol / code UITextFieldDelegate .

This means that all the methods declared in MyViewController must be implemented in the UITextFieldDelegate .

EDIT: It seems that the introduction of Objective-C 2.0 is likely to mark protocol methods as @optional and @required was started.


Comments