Instead of using an application delegate so that the UIApplication
singleton can call the delegate methods at predefined time, what are the advantages and disadvantages of just subclassing UIApplication
? (update: why does the iOS architecture use the application delegate instead of letting people write an application by subclassing UIApplication
and overriding its various methods?)
That's because when we create a new UIView
control, we subclass UIView
(update: or we subclass UIViewController
too). So why for the case of application, we don't subclass UIApplication
but use delegation instead?
Again, from the documentation:
Subclassing Notes
You might decide to subclass UIApplication to override sendEvent: or sendAction:to:from:forEvent: to implement custom event and action dispatching. However, there is rarely a valid need to extend this class; the application delegate (UIApplicationDelegate is sufficient for most occasions. If you do subclass UIApplication, be very sure of what you are trying to accomplish with the subclass.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With