Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does it make sense that there may be more than one class that conforms to the UIApplicationDelegate protocol in an iPhone App?

Tags:

iphone

I think I've understood what that Delegate is supposed to do. If a class conforms to that protocol, it tells the underlying system: "Hey man, I am the UIApplication object's delegate! Tell me what's up, and I may tell you what to do!".

What, if multiple classes implement that? Is that possible? Does that make any sense?

like image 771
Thanks Avatar asked Apr 09 '09 16:04

Thanks


1 Answers

While you could implement multiple classes that conform to the UIApplicationDelegate protocol only one, the first, would receive these messages.

Implementing a protocol to create a delegate is only one part of the equation. That delegate then has to be registered with the code that's generating the messages and these systems generally only support one delegate.

In the case of UIApplication you can change the delegate using the 'delegate' property in the UIApplication shared class but this will replace the original delegate, not add an additional one.

If you need to broadcast UIApplication level messages to other systems then this is functionality you should add to your existing delegate.

like image 72
Andrew Grant Avatar answered Sep 30 '22 22:09

Andrew Grant