title: Swift - changing app when banner loads. - xcode 6 GM
body: <p>I have been working on a mainly text-based application with an Iadbanner in the bottom.</p>
  
  <p>However as we all know, Iads aren't always there. So I would like to be able to dynamically update the height of my textView, so when the banner is hidden, the textView takes up the wasted space. And resize it when a banner is loaded.</p>
  
  <p>Here's what I currently have for the Viewcontroller in question</p>
  
  <pre><code>import UIKit
  import iAd
  
  class DetailVC: UIViewController, UITextViewDelegate, ADBannerViewDelegate {
  
  //Our label for displaying var "Items/cellName"
  @IBOutlet var imageViewOutlet: UIImageView!
  
  //connect in IB connection inspector with your ADBannerView
  @IBOutlet var adBannerView: ADBannerView!
  
  //Receiving variable assigned to our mainVC var "items"
  var cellName: String = ""
  var imageView: UIImageView = UIImageView()
  var image = UIImage(named: "handcuffs.png")
  var textViewText: String = ""
  var textView: UITextView = UITextView(frame: CGRect(x: 5.0, y: 238.0, width: 315.00, height: 283.00))
  //height = 332 for full screen 283 for small
  
  override func viewDidLoad() {
      super.viewDidLoad()
      println("+--------------------+")
      println("| Detail view loaded |")
      println("+--------------------+")
  
      // Iad stuff
      self.adBannerView.delegate = self
      self.canDisplayBannerAds = true
      self.adBannerView.hidden = true //hide until ad loaded
  
      //Setting up the textView
      textView.text = textViewText
      textView.editable = false
      textView.backgroundColor = UIColor.clearColor()
      textView.font = UIFont(name: "Helvetica", size: 15)
  
      //adding textview as subview
      self.view.addSubview(textView)
  
      //ImageViewOutlets
      imageViewOutlet.image = image
  
      //Assign your string var to your navbar title
      self.title = cellName
  
  func bannerViewWillLoadAd(banner: ADBannerView!) {
      NSLog("bannerViewWillLoadAd")
  }
  
  func bannerViewDidLoadAd(banner: ADBannerView!) {
      NSLog("bannerViewDidLoadAd")
      //self.textView.removeFromSuperview()
      //textView = UITextView(frame: CGRect(x: 0.0, y: 238.0, width: 320.00, height: 283.00))
      //self.view.addSubview(textView)
      self.adBannerView.hidden = false //now show banner as ad is loaded
  }
  
  func bannerViewActionDidFinish(banner: ADBannerView!) {
      NSLog("bannerViewActionDidFinish")
      //optional resume paused app code
  }
  
  func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -&gt; Bool {
      NSLog("bannerViewActionShouldBegin")
      //optional pause app code
      return true
  }
  
  func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
      NSLog("didFailToReceiveAdWithError")
  }
  
  //... your class implementation code
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The commented out code in the function "bannerViewDidLoadAd" is what I thought would have fixed my issue. Sadly that function seems to never run? I'm not very familiar with Iads so hopefully someone out there can give me a hint as to how to change the height of a textView when an ad loads.</p>