IAd banner position is not updating

I am currently adding iAd banners to my SpriteKit game and I have successfully served ads. But when I go to remove the banner by pushing it from the bottom, it doesn't move, although this is the exact opposite of the code to make it appear.

This is the function that is called from the notification observer:

func hideBannerAd(notification:NSNotification)
{
    if bannerAdVisible == true
    {
        println(bannerAd.frame);

        UIView.beginAnimations("hideAd", context: nil);
        bannerAd.frame = CGRectOffset(bannerAd.frame, 0, bannerAd.frame.size.height);
        println(bannerAd.frame);
        UIView.commitAnimations()
        bannerAdVisible = false
        bannerAd.cancelBannerViewAction()
    }
}

      

Operators 2 println

produce the following:

(0.0, 1024.0, 768.0, 66.0)

(0.0, 1090.0, 768.0, 66.0)

Thus, the position of the banner changes, but it is not displayed on the screen.

If you know the problem, I would appreciate a little help.

EDIT I will add that hideBannerAd

all the code related to the declaration is in the GamveViewController.

+3


source to share


1 answer


Problem solved!

With @aramusss comment I found that I was calling the function to show the banner in the function viewWIllLayoutSubViews

, so I moved it to the function viewDidLoad

and now it works!



Thanks everyone for your help!

0


source







All Articles