swift - iAd banner below tableview -


i'm creating iad programmatically in tableview application did following in appdelegate.swift wrote

import iad 

than defined proper variable

var bannerview: adbannerview! 

and defined properties of banner itself

bannerview = adbannerview(adtype: .banner) bannerview.settranslatesautoresizingmaskintoconstraints(false) bannerview.delegate = self bannerview.hidden = true 

finally call in tableview controller following

let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate view.addsubview(appdelegate.bannerview) 

with constraints

let viewsdictionary = ["bannerview": appdelegate.bannerview] view.addconstraints(nslayoutconstraint.constraintswithvisualformat("h:|[bannerview]|", options: .allzeros, metrics: nil, views: viewsdictionary)) view.addconstraints(nslayoutconstraint.constraintswithvisualformat("v:|[bannerview]", options: nslayoutformatoptions.allzeros, metrics: nil, views: viewsdictionary)) 

however banner fixed @ top , while i'm scrolling disappearing underneath view. instead should on top of everything. furthermore it's covering part of tableview not visible. how can define tableview starts right below banner or how can move banner below tableview?

thanks

to load banner on top, have try 1 :

import iad  class viewcontroller: uitableviewcontroller, adbannerviewdelegate {  var adbannerview:adbannerview?  override func viewdidload() { super.viewdidload()  adbannerview = adbannerview(adtype: adadtype.banner) adbannerview?.delegate = self //initialize banner , delegate }  override func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { return adbannerview } //with func adbannerview header of tableview. 

hope helps :)


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -