1

I am implementing iAd into a SpriteKit game. I was setting up the game for iPhone retina versions and the two iPad sizes. The software works fine with the SKSceneScaleModeAspectFit and displays everything nicely.

Once I have added the ad banner, the whole scene jumps down by the double height of the ad. If I change to any other scale mode the scene is at the right place, but off course my the scene is not scaled as I have designed the game.

- (void)viewDidLoad
{
[super viewDidLoad];

int y=self.view.bounds.size.height;
skView = ((SKView *) self.view);
//skView.showsFPS = YES;
//skView.showsNodeCount = YES;

// Create and configure the scene.
//int x=skView.bounds.size.width;

SKScene *scene;

switch (y) {
    case 1024:
    case 2048:
        scene = [kickupMyScene sceneWithSize:CGSizeMake(2048, 1536)];
        break;
    case 568:
        scene = [kickupMyScene sceneWithSize:CGSizeMake(2272, 1280)];
        break;
    case 480:
        scene = [kickupMyScene sceneWithSize:CGSizeMake(1920, 1280)];
        break;
    default:
        scene = [kickupMyScene sceneWithSize:CGSizeMake(2048, 1536)];
        break;
}

//scene.scaleMode = SKSceneScaleModeAspectFit;
[scene setYScale:0.2f];

[skView presentScene:scene];
// Present the scene.
self.canDisplayBannerAds=YES;

adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, y/2-adView.frame.size.width/2, 0);
adView.delegate=self;

[skView addSubview:adView];
}

I could not find any solution for this problem so far, so any help is appreciated.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Endre Olah
  • 875
  • 2
  • 9
  • 25
  • 1
    I am having the same problem! It was working fine for me yesterday made no changes to my code and today the scene is dropping down double the height of the ad banner! – 4GetFullOf Feb 26 '14 at 20:55
  • On the 3.5 inch screen retina it seems to drop like 70 pixels and on the 4 inch it drops like 140 even though Im testing on both retina screens what is going on? – 4GetFullOf Feb 26 '14 at 21:30
  • I figured out the problem in situation are you calling any methods with have an ID return? – 4GetFullOf Feb 27 '14 at 01:03
  • There is something wrong with the device rotation I think. I have taken out the iAd view creation from the code and added a interface builder outlet by positioning the add in landscape mode to the top. It works fine now as I wanted. – Endre Olah Feb 27 '14 at 09:36

0 Answers0