开发者

iAd and view controllers

开发者 https://www.devze.com 2023-01-10 22:11 出处:网络
Apple\'s documentation on the UIViewController class has this to say: Note: You should not use view controllers to manage views that fill only a part of their window—that is, only part of the area d

Apple's documentation on the UIViewController class has this to say:

Note: You should not use view controllers to manage views that fill only a part of their window—that is, only part of the area defined by the application content rectangle. If you want to have an interface composed of several smaller views, embed them all in a single root view and manage that view with your view controller.

When using iAd, this is a pain. The problem is that I don't want to be managing my app's content in the same class that has methods like moveBannerViewOffScreen, didFailToReceiveAdWithError, etc. Putting those in the same class reduces modularity. Additionally, I c开发者_如何转开发an't have a navigation stack in which the ad remains in place when other view controllers are pushed.

I am curious if readers have encountered similar issues and if so, how you have dealt with them?


If you want modularity while keep using ivars from the view controller, create a category.


The two approaches that come directly to mind are using a non-UIViewController class as your delegate, or using a subclass of UIViewController as your view controller base class and putting the logic in there.

0

精彩评论

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