-4

Possible Duplicate:
Understanding @Protocols in Objective-C

Could somebody explain what a protocol is in Objective C.

The reason is that on apples
MPMediaPlayback Protocol Reference f has methods to control the video play back, ie I'm trying to get stop to work. The apples documentation at ttp://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProtocols.html says it declarers a interface for others to create. So I was assuming this would mean MPMoviePlayerController would have all the methds in Mpmmediaplayback? Well I try the following [mp stop] and it did nothing. I tried other functions declered in MPM and non of nthem work.

Could somebody explain how a protocol works?

Community
  • 1
  • 1
Ted pottel
  • 6,869
  • 21
  • 75
  • 134

1 Answers1

1

Protocols are a design pattern to allow the developer to customize some appearance/behavior or act on an event. When you implement a protocol's methods, you have the power to control the associated behavior. The foremost example is the UIApplicationDelegate protocol. If you implement the applicationDidFinishLaunching: method, you can define the actions you want to perform when the app has finished launching. As it is an optional method, if you don't implement it, only the default actions are performed.

Akshay
  • 5,747
  • 3
  • 23
  • 35