Prcela Prcela - 6 months ago 23
iOS Question

Navigation toolbar extends vertically after returned from full screen video

The first screenshot is taken before playing video in full screen.

before

The second is taken after the video is opened in full screen and closed.

enter image description here

Any idea why navigation toolbar has extend?

Note: The hamburger button is not the part of the navigation item. It is faked in overlay in parent that holds its child controller inside standard container.

Nothing special inside the source:

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
bbiListic = UIBarButtonItem(image: UIImage(identifier: .IcoHeaderListic), style: .Plain, target: self, action: #selector(UIViewController.showListic))
bbiFavorite = UIBarButtonItem(image: UIImage(identifier: .IcoHeaderStarEmpty), style: .Plain, target: self, action: #selector(LiveDogadjajViewController.toggleFavorite(_:)))

...
let items = [bbiListic!,bbiFavorite!]

navigationItem.rightBarButtonItems = items
}

func someRefresh() {
var items = [UIBarButtonItem]()

items.append(bbiListic!)
...
navigationItem.rightBarButtonItems = items
}


Update:

This appears to be a problem only on the latest version of iOS, 9.3

Answer

I contacted the Apple developer technical support about this issue. They have determined it is probably a bug in iOS 9.3.

Bug id: 26439832, iOS SDK

This is easy workaround for view controller on stack:

// ... add this to init method
let nc = NSNotificationCenter.defaultCenter()
nc.addObserver(self, selector: #selector(didExitFullscreen(_:)), name: MPMoviePlayerDidExitFullscreenNotification, object: nil)

func didExitFullscreen(notification: NSNotification)
{

     // hack, fix for 9.3. 
     if #available(iOS 9.3, *)
     {
         navigationController?.setNavigationBarHidden(true, animated: false)
         navigationController?.setNavigationBarHidden(false, animated: false)
     }
}
Comments