3
由於我在我的trivia應用程序中啓用了iAds,因此每次加載新問題時應該改變的背景不再改變。當我將canDisplayBannerAds一行註釋掉時,它會再次運行。任何想法可能是錯誤的?iAds Swift應用程序的干擾功能
import UIKit
import iAd
class ViewController: UIViewController {
@IBOutlet weak var funFactLabel: UILabel!
@IBOutlet weak var funFactButton: UIButton!
let factBook = FactBook()
let colorWheel = ColorWheel()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
funFactLabel.text = factBook.randomFact()
self.canDisplayBannerAds = true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func showFunFact() {
let randomColor = colorWheel.randomColor()
view.backgroundColor = randomColor
funFactButton.tintColor = randomColor
funFactLabel.text = factBook.randomFact()
}
}
謝謝大衛,這解決了問題!我知道我將在未來使用這個功能,因爲我在所有其他應用上放置了橫幅廣告!再次感謝! – user3375766