开发者

Ads in whole app iPhone problem

开发者 https://www.devze.com 2022-12-26 21:19 出处:网络
I am using mobclix together with admob. The code is to big to add it in all classes. So i created a new class: Ads

I am using mobclix together with admob. The code is to big to add it in all classes. So i created a new class: Ads

Everytime i want an ad in a view, i have to send the view to the ad class:

- (void)initAd:(UIView *) pView {
NSLog(@"ads init");
self.loadedView = pView;
.....

To create an ad in a class:

    Ad* ad = [Ads new];
    [ad initAd:self.view];

I dont know if thats the right way. I have to create a new Ads object everytime i change a view (or class). Is there a way to always have an Ads instance running, or is there another better way?

Thanks alot!!开发者_如何学编程


You probably want to use the Singleton pattern.

For example: What should my Objective-C singleton look like?

0

精彩评论

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