Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 812
Krešimir Prcela Avatar asked May 13 '16 08:05

Krešimir Prcela


2 Answers

From your screenshots, it look like that height of status bar gets doubled. Try this:-

Before playing your video, hide the status bar

UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .None)

After ending the video, show the status bar

UIApplication.sharedApplication().setStatusBarHidden(false, withAnimation: .None)
like image 177
pkc456 Avatar answered Oct 02 '22 01:10

pkc456


Pre-requisite:

a) Uncheck "extends edges" by selecting your uiviewcontroller from main.storyboard

b) no constraints exist between your video player and container controller

Solution:

Check if any of your buttons on the nav bar are bottom constrained. Either remove that constraint or apply a fixed height constraint to your custom nav bar view so that it stays the same height.

like image 24
Harris Avatar answered Oct 02 '22 03:10

Harris