ios - Implementing Inneractive / Inneractive banner ads - ad positioning issue -


i trying use inneractive ad sdk 5+ in application , i'd position ad on bottom. in every case i've tried in middle of screen, centred horizontally , vertically.

code:

self.myadview = [[iaadview alloc]     initwithappid:@"myappid_iphone" adtype:iaadtype_banner delegate:self];  self.myadview.adconfig.refreshintervalinsec = 30;  [[inneractiveadsdk sharedinstance] loadad:self.myadview]; 

delegate method:

- (void)inneractiveadloaded:(iaad *)adview {     nslog(@"ad loaded method called");      // here tried many things found online without effect     [self.view addsubview:self.myadview]; } 

here how implement property @ top of viewcontroller.m file:

@interface viewcontroller () <inneractiveaddelegate>  @property (nonatomic, retain) iaadview* myadview; @end  @implementation viewcontroller @synthesize myadview = _myadview; 

i sure must tiny thing can't figure out. found many solutions include initwithframe not usable in case.

any appreciated.

update 1:

i've tried:

- (void)inneractiveadloaded:(iaad *)adview {     nslog(@"ad loaded method called");     self.myadview.frame=cgrectmake(x,y,width,height); // number , random number 

and

    self.myadview.frame=cgrectoffset(self.myadview.frame, 0, yoffset); // number , random number     [self.view addsubview:self.myadview]; } 

nothing helped. ad stays absolutely centred. starting think there wrong setup besides positioning working fine. see photo below.

app screen

update 2:

tried following without success. ios8 shows banner centred on screen , ios7 reason not @ once line has been added.

- (void)inneractiveadloaded:(iaad *)adview {       nslog(@"ad loaded method called");     self.myadview.frame = cgrectmake(0, self.view.frame.size.height -     self.myadview.frame.size.height , self.view.frame.size.width,    self.myadview.frame.size.height);      [self.view addsubview:self.myadview];  } 

here's working solution: have 2 options here -

  1. wrapping adview in external uiview , have full control
  2. updating frame of adview on 'inneractiveadloaded:' event

anyway: adview must added it's superview before calling 'loadad:' sdk method.

let me know, if have questions.

update: option 2:

#import "viewcontroller.h" #import "inneractiveadsdk.h"  @interface viewcontroller () <inneractiveaddelegate>  @property (nonatomic, strong) iaadview *adview;  @end  @implementation viewcontroller {}  - (void)viewdidload {     [super viewdidload];      self.adview = [[iaadview alloc] initwithappid:@"<your ad unit id>" adtype:iaadtype_banner delegate:self];      [self.view addsubview:self.adview];     [[inneractiveadsdk sharedinstance] loadad:self.adview]; }  - (void)positionad {     const cgfloat x = (self.view.bounds.size.width - self.adview.frame.size.width) / 2.0f;     const cgfloat y = self.view.bounds.size.height - self.adview.frame.size.height;      self.adview.frame = cgrectmake(x, y, self.adview.frame.size.width, self.adview.frame.size.height); }  #pragma mark - inneractiveaddelegate  - (void)inneractiveadloaded:(iaad *)adview {     [self positionad]; }  - (void)inneractivedefaultadloaded:(iaad *)adview {     [self positionad]; }  - (uiviewcontroller *)viewcontrollerforpresentingmodalview { return self; }  @end 

enter image description here


Comments