This is an example of how to dyamically load and place an Google AdMob banner to the bottom of the screen.
- Programmatic implementation.
- No overlay of the view on top of bannerView.
- Detects the connection status and shows and hides the banner accordingly.
- Uses AdMob SmartBanners. Loads SmartBanners for landscape and portrait depending on the current orientation.
How to get started?
- Get a copy of this repo.
- Run
pod install
to get the deps.- Dependencies:
Firebase/Core, Firebase/AdMob, ReachabilitySwift
- Dependencies:
- Open the ShowAndHideAdBanner.xcworkspace
Things to note
- Deployment target is iOS 9.3
- Programming is just a little hobby. This code can be written shorter, safer and more robust. Feel free to request a pull if you improved it.
Demo
-
Hides the banner dynamically on rotaton, loads a new banner for the current orientation.
-
If the connection (WiFi and cell) gets lost, the banner will hide. After connect will load a new banner.
https://rucksack.dev - Rucksack App Development