let backButton = UIBarButtonItem(
title: "",
style: UIBarButtonItemStyle.Plain,
target: nil,
action: nil
);
self.navigationController!.navigationBar.tintColor = UIColor.whiteColor()
self.navigationController!.navigationBar.topItem!.backBarButtonItem = backButton;
i have use above code and i want to add google Interstitial ads in back button of navigation item. my requirement is when i press back from second viewcontroller ads. should would be come and when i close ads. first view controller should open.
thanks
i solved my problem by adding this below code in secondViewController. and its work perfectly.
override func viewWillDisappear(animated: Bool) {
if (interstitial.isReady && showAd) {
showAd = false
print("iterstitalMain is ready")
interstitial.presentFromRootViewController(parentViewController!)
self.createAndLoadInterstitial()
}
else{
}
}