开发者

MonoTouch universal iPhone/iPad app & code duplication

The MonoDevelop IDE, for MonoTouch app, creates separate classes and AppDelegates for iPhone/iPad and there doesn't seem to be an easy way to inherit them from the same base class. Having separa开发者_JAVA技巧te AppDelegate classes would likely result in code duplication in the application.

Can anyone suggest a better app structure for the universal iPhone/iPad app than the one produced by the MonoDevelop IDE?

Alternatively, can anyone suggest any way to have the code common to both AppDelegates not be duplicated?

Thanks in advance.


I don't use MonoTouch (I like the features Objective-C provides a lot) myself, but according to their docs it supports normal object inheritance. So just create your own AppDelegate with the commonly reused methods in it which inherits from MonoTouch.UIApplicationDelegate. Then modify the AppDelegates generated by the Universal application template to inherit from your custom AppDelegate, and remove any methods in those which your base class implements.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜