Any possibility of displaying an iAd banner in a UIModalPresentationFormSheet?
Reading the documentation there are is no size listed for iPad form sheet:
https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/iAd_Guide/BannerAdvertisements/BannerAdvertisements.html
It also says "In the future, additional sizes may be exposed by iAd."
In the meantime, any recommendations on how to handle this? The form view on iPad will display for a long period of time and is where the ad banner should be.
Searching a bit, I see there's some code to display ads from other network types, in this case "ad mob", in a form view:
https://github.com/navisingh/ad-networks/tree/master/GoogleAdMobAdsSDK
If iAd does not support form sheet, then I guess I could search other networks.
UPDATE: Ad Mob supports sizing as follows...
// Size ad banner to form view width
CGFloat aWidth = [self view].frame.size.width;
adMobBannerView_ = [[GADBannerView alloc] initWithAdSize:GADAdSizeFromCGSize(CGSizeMake(aWidth, 60.0f))];
Related
This is not a duplicate..
In the new Admob SDK (Google-Mobile-Ads-SDK 7.31.0) when you show a test ad it shows you a REAL ad(!) and it adds an annotation with the words "Test Ad"
But sometimes, when you really needs an ad to show (for testing purposes) - you get Error code 1 "Request Error: No ad to show."
It IS a test ad. I can see the words "Test Ad" when the test shows! (when it was showed, now nothing shows =[)
SO, my question is:
Does someone knows a workaround?
Now I know the answer... It's a bug in the SDK. =[
see here
The easiest way to load test ads is to use our dedicated test ad unit
ID for iOS banners: ca-app-pub-3940256099942544/2934735716
It's been specially configured to return test ads for every request,
and you're free to use it in your own apps while coding, testing, and
debugging. Just make sure you replace it with your own ad unit ID
before publishing your app.
EDIT: I've found and solved the REAL issue.
When you create an ad, you have two options:
Add it to view hierarchy AFTER it loads an ad ---> works always
Add it to view hierarchy BEFORE it loads an ad ---> BE CAREFUL WITH THIS ONE
If you choose the second approach you have to set the frame of the ad view to a visible size (width + height) and you must ensure that isHidden = false
My problem was that I wanted to animate the showing of the ad. I added the banner to UIStackView and set its isHidden to true.
I used the delegate so when ad was loaded I animated the isHidden to false. All looks good, but apparently the Google Mobile Ads SDK validates that the ad is visible before it loads an ad --- my ad view was NOT visible! so I got the Request Error: No ad to show
Thanks Google for "great" documentation =[
A smartbanner is apple's direct link to the app store. https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html
I am trying to have the smart banner show on the top of the page, content below it, and the nav bar on the bottom. The issue I run into is the smart banner is not counted as part of screen height. If you were to do either:
height: 100%;
screen.innerHeight;
height: 100vh;
or any other typical request for screen height, it ignores the presence of the smart banner and pushes content offscreen by the delta of the smart banner's height.
I am trying to detect if the smart banner is showing on an iOS device to ensure the page fits the window screen regardless of its presence and updates height accordingly. What I've found is that the smart banner shows after the document is ready, and doesn't affect window height. Is there a simple way to detect if the user is being shown the smart banner?
$(document).ready(function() {
heightResize($(".container"));
$(window).resize(function() {
heightResize($(".container"));
$(".container").append("<div class='banner'>this is your dynamically created banner</div>");
$(".container").height($(".container").height()+$(".banner").height());
});
});
function heightResize(element) {
element.height($(window).height()-20);
$("p").text(element.height());
}
Code like this will be pushed off the screen by the smart banner after the page finishes loading.
I have both iAd and AdMob in my application. Can I customize the ad sizes in my application to 320x250? Or are only predefined sizes mentioned in the documentation possible, for example 320x50?
I think it is not possible, but I just want to confirm this.
Yes , Its possible to make custom size with AdMob using DFPBannerView. Please try with below code -
// Define custom GADAdSize 320 x 220
GADAdSize customAdSize = GADAdSizeFromCGSize(320, 220);
self.adBanner = [[DFPBannerView alloc] initWithAdSize:customAdSize];
Please check below url for more details -
https://developers.google.com/mobile-ads-sdk/docs/dfp/ios/banner
This question already has answers here:
How to develop or migrate apps for iPhone 5 screen resolution?
(30 answers)
Closed 9 years ago.
I have an app developed and tested on my iPhone 5, but now I would like to make it work on older iphones as 4 and 4s. The functionalities work in the same way, but there are some buttons which do not appear because of the screen resolution.
Is there any way I can make the same .xib to work on different screen resolutions?
a) You can always design your interfaces (.xib) with anchor or elastic coordinates, so if the screen is bigger/smaller, the coordinates are relative to one of the edges of the screen.
b) You can WRAP the entire screen in a UIScrollView and let the user SCROLL to access all buttons.
These are the easiest. a) will give you more headaches. I would go for b) because it's more time efficient.
For b) I also recommend that you TRY the interface in a smaller screen and check that the hidden content is PARTIALLY VISIBLE, so users have a HINT that there's "something down there".
EDIT
This is an example for initializing a viewController with different xib files.
- (id)init
{
int model = ... //some model inspection method;
switch(model) {
case iphone3g:
return [self initWithNibName:#"iphone3g.xib" bundle:nil];
case iphone4:
case iphone4s:
return [self initWithNibName:#"iphone4x.xib" bundle:nil];
... //etc
I would suggest Apple's WWDC videos on auto layout, those will help with using the same XIB. It really depends on your interface and what you're looking to do, there's no one right answer.
You could also create two XIBs, one for 480 height and another for 568, then write in code a bit to ask the device what size it is, and load the appropriate XIB. This can be useful if auto layout just seems to be a big pain with what you're implementing.
Hi friends now i am developing Ads for Ipad,I am Using Admob.i have a small problem.
in admob documentation itself adsize in portrait view is 728x90.i want to change adsize to 768x90 to fit exactly in screen.i have changed frame by calling setFrtame for AdBannerView but it cant changes the size
*is it possible to change add size...? and at the same time i nee to show add in landscape with size 1024x90 *
Here is My Code
[AdmobBanner setFrame:CGRectMake(0,0,768,90)]; //Portrait
[AdmobBanner setFrame:CGRectMake(0,0,1024,90)]; //Landscape
Can any one help me to find the solution For this
AdMob currently supports only few ad dimensions. There is no way how to set your own size. Best thing to do would be to insert your ad into some kind of visual container with proper dimensions and fill rest of the screen with appropriate graphics