MREC
MREC is a 300x250 banner. This type can be useful if the application interface has a large free area for placing a banner.
Check If Ad Is Loaded
- Swift
- Objective-C
// MREC view
mrec.isReady
// MREC view
mrec.isReady;
Display
AppodealMRECView is a subclass of AppodealBannerView. The size of
AppodealMRECView is 300x250.
MREC ads are refreshed every 15 seconds automatically by default. To display MREC, you need to call the following code:
- Swift
- Objective-C
import UIKit
import Appodeal
class YourViewController: UIViewController, AppodealBannerViewDelegate {
override func viewDidLoad () {
super.viewDidLoad()
// required: init ad banner
let mrecView: AppodealMRECView = AppodealMRECView()
mrecView.usesSmartSizing = false
mrecView.rootViewController = self
// optional: set delegate
mrecView.delegate = self
// required: add banner to superview and call -loadAd to start banner loading
self.view.addSubview(mrecView)
mrecView.loadAd()
}
// optional: implement any of AppodealBannerViewDelegate methods
func bannerViewDidLoadAd(_ bannerView: APDBannerView, isPrecache precache: Bool) {
NSLog("bannerView was loaded")
}
func bannerView(_ bannerView: APDBannerView, didFailToLoadAdWithError error: Error) {
NSLog("bannerView failed to load");
}
func bannerViewDidInteract(_ bannerView: APDBannerView) {
NSLog("bannerView was clicked")
}
func bannerViewDidShow(_ bannerView: APDBannerView) {
NSLog("bannerView was shown")
}
func bannerViewExpired(_ bannerView: APDBannerView) {
NSLog("bannerView did expire and could not be shown")
}
}
#import "YourViewController.h"
#import <Appodeal/Appodeal.h>
interface YourViewController () <AppodealBannerViewDelegate>
@end
@implementation YourViewController
- (void)viewDidLoad {
[super viewDidLoad];
// required: init ad banner
AppodealMRECView *mrecView= [[AppodealMRECView alloc] initWithRootViewController:self];
// optional: set delegate
mrecView.delegate = self;
// required: add banner to superview and call loadAd to start banner loading
[self.view addSubview:mrecView];
[mrecView loadAd];
}
// optional: implement any of AppodealBannerViewDelegate methods
- (void)bannerViewDidLoadAd:(APDBannerView *)bannerView {
NSLog(@"Banner %@ did load!", bannerView);
}
- (void)bannerViewDidInteract:(APDBannerView *)bannerView {
NSLog(@"Banner %@ did interact", bannerView);
}
- (void)bannerView:(APDBannerView *)bannerView didFailToLoadAdWithError:(NSError *)error {
NSLog(@"Banner %@ did fail with error: %@", bannerView, error);
}
- (void)bannerViewDidRefresh:(APDBannerView *)bannerView {
NSLog(@"Banner %@ did refresh ", bannerView);
}
@end
You can use our demo app as a reference project.
Demo App
If you want to use advanced MREC integration, you can find detailed documentation here