chrisjp / CJPAdController

A singleton class providing a simple way to add iAd and AdMob ads to a view controller. Choose one as the default, fall back to the other.
http://chrisphillips.co.uk
MIT License
202 stars 58 forks source link

Status Bar disappears when playing fullscreen video #24

Closed jcsobrino closed 9 years ago

jcsobrino commented 9 years ago

I am using CJPAdController below a UITabBarController bar items. This is the configuration code written in Swift:

class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.

        CJPAdController.sharedInstance().adNetworks = [1]
        CJPAdController.sharedInstance().adPosition = CJPAdPosition.Bottom
        CJPAdController.sharedInstance().initialDelay = 2.0

        let storyBoard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
        let initViewController = storyBoard.instantiateViewControllerWithIdentifier("InitTabBarController") as UIViewController

        CJPAdController.sharedInstance().startWithViewController(initViewController)
        self.window!.rootViewController = CJPAdController.sharedInstance()
        return true
    }

Everything is working fine but when I play a video with AVPlayerViewController in fullscreen and close the controller, the status bar gets hidden. This is the class I am using:


class PlayerViewController: AVPlayerViewController {

    var file:NSString!

    override func viewDidLoad() {
        super.viewDidLoad()

        let videoURL = NSURL(fileURLWithPath: file)
        self.player = AVPlayer.playerWithURL(videoURL) as AVPlayer

        self.player.play()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

 }

I coding for iOS 8.1

jcsobrino commented 9 years ago

I saw the workaround in the issue #14 and it worked perfectly. Thanks!