开发者

Custom Delegates

I've read in a number of places that using the AppDelegate as the heart of the application is bad (apart from the actual UIApplication delegates themselves).

Would it be wise to create custom delegate classes to keep code modularized.

For example if I need to forma开发者_如何学Got various text inputs, create a Formatter delegate class and set the delegate on any text input object that needs to be formatted?

Does that make sense?


The point of the articles you've read is 'Do not keep all application logic in app delegate'. Responsibility of app delegate is to handle important events in app lifecycle in lightweight way by notifying appropriate parts of application, not to manage views or data flows or network calls. For example in application:didFinishLaunchingWithOptions: delegate usually adding root controller's view into window, makes this window active and leaves everything else to controller.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜