-
Notifications
You must be signed in to change notification settings - Fork 8
Integrating Inline Ad
Vladas Drejeris edited this page Jun 3, 2021
·
4 revisions
It is very easy to use Adform Advertising SDK to place ad banners in your application. The example code provided below shows you how to add an inline ad to your view controller. You just need a Master Tag Id and you can display ads in your application.
There are two options to add ads inside your application content, you can use AdInline and AdHesion classes. For this example, we will use AdInline. Let's add one ad in your view controllers viewDidLoad
method.
Swift
override func viewDidLoad() {
super.viewDidLoad()
//Create a new ad inline object with Master tag id.
let adView = AFAdInline(masterTagId: masterTag, presenting: self)
//Set ad views frame to place ad centered in the screen just below the status bar.
adView.frame = CGRect(
x: (self.view.frame.size.width - adView.adSize.width) / 2,
y: 20,
width: adView.adSize.width,
height: 0
)
//Add the newly created ad view as a subview to your view controller's view.
view.addSubview(adView)
//Initiate ad loading.
adView.loadAd()
}
Objective-C
#import <AdformAdvertising/AdformAdvertising.h>
- (void)viewDidLoad
{
[super viewDidLoad];
//Create a new ad inline object with Master tag id.
AFAdInline *adView = [[AFAdInline alloc] initWithMasterTagId:mtag presentingViewController:self];
//Set ad views frame to place ad centered in the screen just below the status bar.
adView.frame = CGRectMake((self.view.frame.size.width - adView.adSize.width) / 2, 20, adView.adSize.width, 0);
//Add the newly created ad view as a subview to your view controller's view.
[self.view addSubview:adView];
//Initiate ad loading.
[adView loadAd];
}
That's it! You are ready to go.
For a complete example of how to integrate Adform inline ads into your application, check out the sample app.
Basic integrations
- Integrating Inline Ad
- Integrating Full Screen Overlay Ad
- Integrating AdHesion Ad
- Integrating Interstitial Ad
- Video Ad Integration
- Debug mode
- Troubleshooting
Advanced integrations
- Advanced Inline Ad Integration
- Integrating Inline Ads in UITableView
- Advanced Full Screen Overlay Ad Integration
- Advanced Interstitial Ad Integration
- Instream Video Ads
Other
- Adding Custom Values
- Adding Keywords
- Adding Key Value Pairs
- Adding Search Words
- Location Tracking
- Security
- Ad Tags
- Header Bidding
- Changing ADX Domain
- Specifying banner loading behaviour
- Customizing in app browser
- GDPR
- US Privacy
- Localization
- In app deeplinks
Mediation adapters