Bob Williams Bob Williams - 2 months ago 18
Swift Question

Making adMob position to bottom of screen Xcode/Swift

my BannerAd is currently at the top, how can I change its position to the bottom portrait?

var Banner = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)


var request:GADRequest = GADRequest()




override func viewDidLoad() {
super.viewDidLoad()



func showBanner() {
Banner.hidden = false
Banner.adUnitID = "ca-app-pub-**************"
Banner.rootViewController = self
Banner.delegate = self
self.view.addSubview(Banner)
Banner.loadRequest(request)

request.testDevices = [kGADSimulatorID];

}


what should i add?

Answer
Banner.frame = CGRect(x:0, y:self.view.frame.size.height - Banner.frame.size.height, width:Banner.frame.size.width, height:Banner.frame.size.height)
Comments