NimbleKit - fast iOS app development

iAd banner orientation iPad

Problem discussions

iAd banner orientation iPad

Postby Dilemma Apps » Sat Jun 04, 2011 3:28 pm

Seems to be a bug with the following code

I can set up an iAd banner in either orientation but it cannot then be changed when the device changes orientation,

If the is horizontal is set on the first call, there is no way to change it later if the orientation changes.

Code: Select all
var banner = new NKBanner;
banner.init(0,0);
var isHorizontal = '';

function bannerViewDidLoadAd(){
        if(window.innerWidth > 1000){
            isHorizontal = "yes";
        } else {
            isHorizontal = "no";
        }
        banner.init(0, 0, isHorizontal);
banner.show();
}


Can someone else please confirm this is the case
User avatar
Dilemma Apps
 
Posts: 137
Joined: Tue Jan 04, 2011 7:59 pm
Location: Kent, UK

Re: iAd banner orientation iPad

Postby Dilemma Apps » Sat Jun 04, 2011 3:31 pm

User avatar
Dilemma Apps
 
Posts: 137
Joined: Tue Jan 04, 2011 7:59 pm
Location: Kent, UK

Re: iAd banner orientation iPad

Postby sunny » Sat Jun 04, 2011 3:42 pm

moved from "General" to "Troubleshooting", please pay attention when posting
User avatar
sunny
Staff
 
Posts: 2666
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: iAd banner orientation iPad

Postby Dilemma Apps » Sat Jun 04, 2011 3:52 pm

Sunny, can you confirm this is a bug?
User avatar
Dilemma Apps
 
Posts: 137
Joined: Tue Jan 04, 2011 7:59 pm
Location: Kent, UK

Re: iAd banner orientation iPad

Postby sunny » Sun Jun 05, 2011 1:36 am

not, it's not a bug, there must be 2 ads for each orientation and you show/hide related ads on rotation event
maybe it will be done automatically by NimbleKit but I doubt it will happen soon.
User avatar
sunny
Staff
 
Posts: 2666
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: iAd banner orientation iPad

Postby Dilemma Apps » Mon Jun 06, 2011 11:47 am

I didn't think about doing it like that,

thanks
User avatar
Dilemma Apps
 
Posts: 137
Joined: Tue Jan 04, 2011 7:59 pm
Location: Kent, UK

Re: iAd banner orientation iPad

Postby SteveSetzer » Tue May 29, 2012 8:32 pm

Sunny, I didn't quite understand the advice here:

sunny wrote:not, it's not a bug, there must be 2 ads for each orientation and you show/hide related ads on rotation event
maybe it will be done automatically by NimbleKit but I doubt it will happen soon.


Do you mean two calls to NKBanner, like this:

Code: Select all
           var portraitBanner = new NKBanner;
            var landscapeBanner = new NKBanner;
            portraitBanner.init(0,937);
            landscapeBanner.init(0,700);

            function bannerViewDidLoadAd()
            {
            ... // code to detect orientation
                if(portrait) { 
                    portraitBanner.show();
                    landscapeBanner.hide();
                } else { 
                    landscapeBanner.show();
                    portraitBanner.hide();
                }


It seemed to work when I did it, but of course it tried to load ads twice, so sometimes it fired bannerViewDidLoadAd() twice and other times it fired bannerViewDidLoadAd() once and didFailToReceiveAdWithError(error) once.

Just want to be sure that's what you were saying. Thanks!
SteveSetzer
 
Posts: 4
Joined: Thu Jun 09, 2011 5:45 am


Return to Troubleshooting

Who is online

Users browsing this forum: Google [Bot] and 1 guest