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

Presenting From UINavigationController with Navigation Bar and Status Bar Shown Causes Navigation Bar to Animate Up #10

Open
bcapps opened this issue Feb 27, 2015 · 7 comments
Labels

Comments

@bcapps
Copy link
Contributor

bcapps commented Feb 27, 2015

This is the default behavior when presenting view controllers that don't show the status bar, however we could account for it in the animator.

@bcapps bcapps added the bug label Feb 27, 2015
@bcapps bcapps added this to the First Pod Release milestone Feb 27, 2015
@bcapps bcapps modified the milestones: Nice to Have, First Pod Release Mar 6, 2015
@bcapps bcapps removed this from the Nice to Have milestone Mar 25, 2015
@agordeev
Copy link

Unfortunately, this issue still persists :(

@wraithseeker
Copy link

wraithseeker commented Aug 3, 2016

Has anyone found a fix for this bug?

@yunnnyunnn
Copy link

Here's my workaround (in swift) @wraithseeker @andrew8712 :
First, subclass NYTPhotosViewController like this:

class FixedPhotosViewController: NYTPhotosViewController {
    var shouldHideStatusBar = false
    override func prefersStatusBarHidden() -> Bool {
        return shouldHideStatusBar
    }
}

Then, initiate the controller like this:

let photosViewController = FixedPhotosViewController(photos: [photo])
self.presentViewController(photosViewController, animated: true) { 
      photosViewController.shouldHideStatusBar = true
      photosViewController.setNeedsStatusBarAppearanceUpdate()
}

@agordeev
Copy link

agordeev commented Aug 5, 2016

@yunnnyunnn Thanks, your workaround works fine!

@elsesiy
Copy link

elsesiy commented Jan 5, 2017

Swift 3 workaround:

import NYTPhotoViewer

class TempfixPhotosViewController : NYTPhotosViewController {

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        UIApplication.shared.isStatusBarHidden = true
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)

        // Show statusbar after dismissal again
        UIApplication.shared.isStatusBarHidden = false
    }
    
    override var prefersStatusBarHidden: Bool {
        return true
    }
}

@BesatZardosht
Copy link

Objective c:

My_NYPhotoViewController.h file:

#import <Foundation/Foundation.h>
#import <NYTPhotoViewer/NYTPhotosViewController.h>

@interface My_NYPhotoViewController: NYTPhotosViewController
@end

My_NYPhotoViewController.m file:

#import "My_NYPhotoViewController.h"

@implementation My_NYPhotoViewController

- (BOOL)prefersStatusBarHidden {
    return NO;
}

@end

@benguild
Copy link

benguild commented May 1, 2018

It seems like a better workaround is to disable the status bar hiding entirely, and then use this pull-request: #221

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

No branches or pull requests

7 participants