fixed scaling issue of ad in webseries.
This commit is contained in:
@@ -42,7 +42,7 @@ class GamesListVC: UIViewController {
|
||||
Task {
|
||||
do {
|
||||
interstitial = try await GADInterstitialAd.load(
|
||||
withAdUnitID: "ca-app-pub-3940256099942544/4411468910", request: GADRequest())
|
||||
withAdUnitID: "ca-app-pub-5699008063638916/8126400123", request: GADRequest())
|
||||
interstitial?.fullScreenContentDelegate = self
|
||||
|
||||
rewardedAd = try await GADRewardedAd.load(
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import GoogleMobileAds
|
||||
|
||||
protocol ReloadSeriesFavLike{
|
||||
func updateRows(index : Int, type : FavCellCLick, isFav : Bool? , isLike : Bool?, id : Int?)
|
||||
@@ -105,6 +106,26 @@ class WebSeriesVC: UIViewController {
|
||||
override func viewDidLayoutSubviews() {
|
||||
super.viewDidLayoutSubviews()
|
||||
vm.updateTableHeight()
|
||||
|
||||
var bannerView = GADBannerView()
|
||||
|
||||
let viewWidth = headerView.frame.inset(by: headerView.safeAreaInsets).width
|
||||
|
||||
// Here the current interface orientation is used. Use
|
||||
// GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth or
|
||||
// GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth if you prefer to load an ad of a
|
||||
// particular orientation,
|
||||
let adaptiveSize = GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth)
|
||||
bannerView = GADBannerView(adSize: adaptiveSize)
|
||||
|
||||
bannerView.center = headerView.center
|
||||
|
||||
bannerView.frame = CGRect(x: 0, y: 0, width: headerView.frame.width, height: headerView.frame.height)
|
||||
headerView.addSubview(bannerView)
|
||||
bannerView.adUnitID = K.GoogleAdIDs.themeTwo
|
||||
bannerView.rootViewController = self
|
||||
bannerView.load(GADRequest())
|
||||
bannerView.layoutIfNeeded()
|
||||
}
|
||||
|
||||
// MARK: - Tap Handler
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
import Alamofire
|
||||
import GoogleMobileAds
|
||||
|
||||
class WebSeriesVM{
|
||||
|
||||
@@ -115,24 +114,7 @@ class WebSeriesVM{
|
||||
}
|
||||
}
|
||||
}else{
|
||||
var bannerView = GADBannerView()
|
||||
|
||||
let viewWidth = vc.headerView.frame.inset(by: vc.headerView.safeAreaInsets).width
|
||||
|
||||
// Here the current interface orientation is used. Use
|
||||
// GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth or
|
||||
// GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth if you prefer to load an ad of a
|
||||
// particular orientation,
|
||||
let adaptiveSize = GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth)
|
||||
bannerView = GADBannerView(adSize: adaptiveSize)
|
||||
|
||||
bannerView.center = vc.headerView.center
|
||||
|
||||
bannerView.frame = CGRect(x: 0, y: 0, width: vc.headerView.frame.width, height: vc.headerView.frame.height)
|
||||
vc.headerView.addSubview(bannerView)
|
||||
bannerView.adUnitID = K.GoogleAdIDs.themeTwo
|
||||
bannerView.rootViewController = self.vc
|
||||
bannerView.load(GADRequest())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user