-
Notifications
You must be signed in to change notification settings - Fork 0
Visible Frame
Yieldmo ads can use a visible frame to fine-tune the appearance animations and engagement event reporting. You should set a visible frame if you have navigation bars, tab bars, or other frames that will appear on top of the page that contains the ad. The frame you return should be in the window's coordinate space.
To implement the visible frame, conform to the YMPlacementViewDelegate. If you do not set a visible frame, the placement will use the entire application window as the visible frame. For example, the following delegate method implementation would send the correct visible frame for a simple application with a navigation and status bar:
- (CGRect) visibleContainerFrame: (YMPlacementView *) placementView {
CGFloat navigationBarHeight = self.navigationController.navigationBar.frame.size.height;
CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
CGFloat yOffset = navigationBarHeight + statusBarHeight;
CGRect rect = CGRectMake(0, yOffset, self.view.frame.size.width, self.view.frame.size.height - yOffset)
// convert to window coordinate space
return [self.view.superview convertRect:rect toView:nil];
}func visibleContainerFrame(placementView: YMPlacementView) -> CGRect {
let navigationBarHeight = self.navigationController?.navigationBar.frame.height
let statusBarHeight = UIApplication.sharedApplication().statusBarFrame.height
let yOffset = (navigationBarHeight ?? 0.0) + statusBarHeight
let rect = CGRectMake(0, yOffset, self.view.frame.width, self.view.frame.height - yOffset)
// convert to window coordinate space
return self.view.superview!.convertRect(rect, toView: nil)
}Here, an example visible frame is highlighted in red:
Start Here
iOS Version Support
Troubleshooting & Logging
Have a previous SDK?
