David Seek David Seek - 10 months ago 79
Swift Question

Swift / iAd bannerView / how to set the position

I am trying to add iAd into my app using the following code:

var bannerView: ADBannerView!
override func viewDidLoad() {

bannerView = ADBannerView(adType: .Banner)
bannerView.translatesAutoresizingMaskIntoConstraints = false
bannerView.delegate = self
bannerView.hidden = true
bannerView.frame = CGRectMake(0, 400, view.frame.size.width, bannerView.frame.size.height)

Even using the
frame = CGRectMake
stuff, my banner is at the bottom of my app... No matter how I change the x/y values. The banner stays at the bottom... What am I missing? Help is very appreciated.


Try as Follow:

var adBannerView: ADBannerView  
adBannerView = ADBannerView(frame: CGRectMake(0, 0, 50, screenBounds.width))
adBannerView.center = CGPoint(x: screenBounds.width/2, y: screenBounds.height-adBannerView.frame.height)
adBannerView.delegate = self
adBannerView.hidden = true