Reputation: 317
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.
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
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
Reputation: 3907
Just Try this:
- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView {
CGRect newFrame=CGRectMake(0, 410, 320, 50);
adWhirlView.frame = newFrame;
}
Upvotes: 1
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