I need to have my banner ads stratched/filled all across the width of the screen at the bottom.
My code is working for the devices with the width equal to either MOPUB_BANNER_SIZE.width or MOPUB_LEADERBOARD_SIZE.width But on other devices (iPhone 5/6/etc and some iPads) my only option is to center the banner. here is the code:
if(!_mopubBanner){
NSString* bannerID;
const CGSize* bannerSize;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
bannerID = @"MopubBannerId";
bannerSize = &MOPUB_BANNER_SIZE;
}
else{
bannerID = @"MopubLeaderboardId";
bannerSize = &MOPUB_LEADERBOARD_SIZE;
}
_mopubBanner = [[MPAdView alloc] initWithAdUnitId:bannerID size:*bannerSize];
_mopubBanner.delegate = self;
CGRect BannerFrameRect;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
BannerFrameRect = CGRectMake(([[UIScreen mainScreen] bounds].size.width - MOPUB_BANNER_SIZE.width) / 2,
[[UIScreen mainScreen] bounds].size.height - MOPUB_BANNER_SIZE.height,
MOPUB_BANNER_SIZE.width,
MOPUB_BANNER_SIZE.height);
}
else
{
BannerFrameRect = CGRectMake(([[UIScreen mainScreen] bounds].size.width - MOPUB_LEADERBOARD_SIZE.width) / 2,
[[UIScreen mainScreen] bounds].size.height - MOPUB_LEADERBOARD_SIZE.height,
MOPUB_LEADERBOARD_SIZE.width,
MOPUB_LEADERBOARD_SIZE.height);
}
_mopubBanner.frame = BannerFrameRect;
}
I have tried setting custom sizes for BannerFrameRect but the banner ad just keeps adjusting itself to the top left corner of the new frame. It does not get scaled.
is there any way to resize the ad?
thank you