Bringing a subview to be in front of all other views
try this:
self.view.layer.zPosition = 1;
Swift 2 version of Jere's answer:
UIApplication.sharedApplication().keyWindow!.bringSubviewToFront(YourViewHere)
Swift 3:
UIApplication.shared.keyWindow!.bringSubview(toFront: YourViewHere)
Swift 4:
UIApplication.shared.keyWindow!.bringSubviewToFront(YourViewHere)
Hope it saves someone 10 seconds! ;)
What if the ad provider's view is not added to self.view
but to something like [UIApplication sharedApplication].keyWindow
?
Try something like:
[[UIApplication sharedApplication].keyWindow addSubview:yourSubview]
or
[[UIApplication sharedApplication].keyWindow bringSubviewToFront:yourSubview]