views:

78

answers:

1

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!!

+1  A: 

You probably want to use the Singleton pattern.

For example: http://stackoverflow.com/questions/145154/what-does-your-objective-c-singleton-look-like

David Gelhar