theMouse
theMouse

Reputation: 317

How to put adWhirl at the Bottom of the Iphone screen?

I downloaded a copy of the adWhirl PRO sample files for iphone from www.adwhirl.com to learn how to implement adWhirl into an app.

The default postion of the ad banner is on top of the screen.

I am trying to position the banner at the bottom instead.

After searching in Google Groups, I have tried in the .m file

- (void)viewDidLoad {
    [super viewDidLoad];

    AdWhirlView *adWhirlView = [AdWhirlView requestAdWhirlViewWithDelegate:self];

    adView.frame = CGRectMake(0, 410, kAdWhirlViewWidth, kAdWhirlViewHeight); 

    [self.view addSubview:adWhirlView];
}

But the ad Banner remains in the same position.

I also tried modifying the adWhirlView.h file, by changing:

#define kAdWhirlViewDefaultFrame \
                        (CGRectMake(0,0,kAdWhirlViewWidth, kAdWhirlViewHeight))

to

#define kAdWhirlViewDefaultFrame \
                        (CGRectMake(0,410,kAdWhirlViewWidth, kAdWhirlViewHeight))

But the adView position remains the same, on top, it does shift the ad Banner down, but it also shifts down the ad itself within the adView, such that if you changed 410 to 25, only half the ad banner will show.

screenshot

What am I doing wrong, please?

Does anyone know how to place the adView at the bottom of the screen, please?

Many Thanks

Upvotes: 2

Views: 1797

Answers (3)

Shubhank
Shubhank

Reputation: 21805

Implement this Adwhirl delegate method

- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView {

    CGSize adSize = [adWhirlView actualAdSize];     
    CGRect newFrame = adWhirlView.frame;        
    newFrame.size = adSize;     
    newFrame.origin.x = (self.view.bounds.size.width - adSize.width)/ 2;        
    newFrame.origin.y=  self.view.frame.size.height - adSize.height;        
    adWhirlView.frame = newFrame;       
 }

Upvotes: 9

Hector
Hector

Reputation: 3907

Just Try this:

- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView {

CGRect newFrame=CGRectMake(0, 410, 320, 50);
adWhirlView.frame = newFrame;
}

Upvotes: 1

benwad
benwad

Reputation: 6594

The easiest way would be to use a Nib. Open the view's .xib file and insert a new UIView object at the bottom with the desired dimensions. Then in the Identity inspector set the class to AdWhirlView, and in the Size inspector set it so it anchors to the bottom, left and right of the screen.

Upvotes: 0

Related Questions