views:

446

answers:

2

Hello, i am trying to integrate adwhirl to my iphone game. it is opengl based and in landscape mode.

If i just place the ads they show fine but as if the app was in portrait mode. i need to rotate them.

I just can't get them to show right. i am trying this:

  [SimpleGameAppDelegate get].adView = [AdWhirlView requestAdWhirlViewWithDelegate:[SimpleGameAppDelegate get]];
  [[SimpleGameAppDelegate get].adView setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin];
  [[SimpleGameAppDelegate get].adView setClipsToBounds:YES];

  CGAffineTransform cgCTM = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(-270));
  cgCTM = CGAffineTransformTranslate(cgCTM,0,0);
  [[SimpleGameAppDelegate get].adView setTransform:cgCTM];

  [[SimpleGameAppDelegate get].adView setCenter:CGPointMake(160, 240)];
  [[SimpleGameAppDelegate get].adView setBounds:CGRectMake(0, 0, 320, 50)];

  [[[Director sharedDirector] openGLView] addSubview:[SimpleGameAppDelegate get].adView];

i am using that code which for custom ads works fine, but for example with admob the ad shows clipped... it always shows clipped as a square which sides are the lower from the bounds i set... so having set as 320 x 50 it shows an small square of 50 px...

Thanks in advance

A: 

i never could solve this, the weird thing is that admob ads are the ones that show up wrong, but if i use admob's sdk i can rotate them and they show fine

pabloruiz55
A: 

I had the same problem. I found that the admob view was clipped. So you have to use set the clipsToBounds property of AdWhirlView to false. Here is the code I'm using:

awView = [AdWhirlView requestAdWhirlViewWithDelegate:awDelegate];
CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(MBLIB_DEGREES_TO_RADIANS(90));
[awView setTransform:landscapeTransform];
[awView setFrame:CGRectMake(0, 0, 480, 50)];
[awView setCenter:CGPointMake(-190, 25)];
[awView setClipsToBounds:false]; // Here is the important line
Maxime