Closed paoloandrea closed 9 years ago
What do you mean "in the runtime"? Do you mean at runtime?
There is a property on LARSAdController that should allow you to pin to the top or the bottom:
/** The location that the ad banner container will pin itself to.
*/
@property (nonatomic) LARSAdControllerPinLocation pinningLocation;
Hi Iarsacus, thank you for respond me, but my question is different.
I need to put the banner in a custom position in my view controller. How can i manage the position x and y of the banner? Thank's for your great work.
You have full access to the banner container that you can do whatever you want to with:
/** The container view that the ads are contained in. Exposed so you can do anything you would want with it.
*/
@property (nonatomic, readonly, strong) LARSAdContainer *containerView;
Using containerView I still have the problem of positioning of the banner.
What I want to do is just place it at 60px from the footer.
Here's the code but does not respond properly.
Can you help me fix it? Thank You.
(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { CGFloat width; CGFloat height;
CGFloat yOrigin = 0; CGFloat parentWidth = CGRectGetWidth(self.view.frame); CGFloat parentHeight = CGRectGetHeight(self.view.frame); if((fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight)) { yOrigin = MIN(parentHeight-CONTROLLER_HEIGHT, parentWidth); width = MAX(parentHeight, parentWidth); } else { yOrigin = MAX(parentHeight-CONTROLLER_HEIGHT, parentWidth); width = MIN(parentHeight, parentWidth); } if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ height = 90; } else{ height = 50; } CGRect newFrame = CGRectMake(0.f, yOrigin-height, width, height); [[LARSAdController sharedManager].containerView setFrame:newFrame]; }
Ok actually it looks like whatever you're doing is not going to work with how the internals are currently implemented. The library will still modify the frame based on the pinning position you have chosen, so setting a frame will likely get overridden when LARSAdController lays itself out.
How can i add the banner in a particular position in the interface in runtime. Have an example? Thank's to help me.