Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move content under statusBar if prefersStatusBarHidden is false #221

Closed
wants to merge 2 commits into from
Closed

Move content under statusBar if prefersStatusBarHidden is false #221

wants to merge 2 commits into from

Conversation

sergiog90
Copy link

Allow developers to show the status bar with navigation bar buttons without overlaps.
If gallery is showed with visible status bar the navigation buttons overlaps it, with this small change you can set to move content origin under status bar to prevent it.

Before:
captura de pantalla 2016-11-24 a las 15 50 47

After:
captura de pantalla 2016-11-24 a las 15 49 44

Code:

private class PhotosViewController: NYTPhotosViewController {
    override var prefersStatusBarHidden: Bool {
        return false
    }
    
    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
    }
}

let viewer = PhotosViewController(photos: [photo], initialPhoto: photo, delegate: nil)
viewer.underStatusBar = true
self.present(viewer, animated: true, completion: nil)

@livings124
Copy link
Contributor

A version of this that only shows the status bar when the chrome is shown would be great. I might take my hand at it if you don't want to include it here.

@scottcc
Copy link

scottcc commented Mar 1, 2017

+1 for this. Had issues when dismissing the NYTPhotosViewController, the now-shown VC would have things overlapping, no matter what setNeedsStatusBarUpdate/NeedsLayout/NeedsWhatever was called. Moved my Podfile pointer to your commit, no more problems. Nicely done!

@justColbs
Copy link

@scottcc Could you show me what that line in your Podfile looked like? It's giving me issues. Thanks!

@scottcc
Copy link

scottcc commented Apr 4, 2017

Sure:
pod 'NYTPhotoViewer', :git => 'https://github.com/sergiog90/NYTPhotoViewer.git', commit: '06da6a02151cc5c28adddd77c9d729c7a103ac48'

@Huang-Libo
Copy link

+1

@benguild
Copy link

benguild commented May 1, 2018

Anybody else seeing the content jump downward the height of the status bar to accommodate after the modal finishes transitioning in?

@benguild
Copy link

benguild commented May 1, 2018

@sergiog90 Regarding my prior comment from about an hour ago, I found that the animations are no longer offset/broken between view and modal if you leave the pageViewController as-is:

self.pageViewController.view.frame = self.view.bounds; // frame;

That way, the photo remains centered on the screen, but the navigation bar isn't clipping the status bar?

Does this look OK to you, or break something that you were intending to change? I think maybe it's best to update your branch if fine.

@mr-fixit
Copy link
Contributor

mr-fixit commented Dec 9, 2020

a belated thanks for this submission @sergiog90!

i'm closing this PR in favor of #336.

@mr-fixit mr-fixit closed this Dec 9, 2020
@BenderNK
Copy link

BenderNK commented Feb 24, 2023

neither this nor the referenced #336 pull request has been merged as of this writing. 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants