TimOliver / TOWebViewController

A view controller class for iOS that allows users to view web pages directly within an app.
http://www.timoliver.com.au/2014/07/27/towebviewcontroller-an-open-source-web-viewer-for-ios/
Other
1.48k stars 211 forks source link

navigationController.navigationBar becomes visible after leaving the TOWevViewController #68

Closed Usipov closed 8 years ago

Usipov commented 9 years ago

Hello there! Thanx for the amazing tool you've created Please take a look at a small problem I've confronted

- (void)viewDidLoad
{
    [super viewDidLoad];

    if (self.navigationController) {
        self.hideToolbarOnClose = self.navigationController.toolbarHidden;
        self.hideNavBarOnClose  = self.navigationBar.hidden;
    }
...

In some rare cases it may occur, that viewDidLoad gets called before the view controller gets inserted in the navigation controller's stack. This will cause the toolbar to appear after the view disappears

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    if (self.beingPresentedModally == NO) {
        [self.navigationController setToolbarHidden:self.hideToolbarOnClose animated:animated];
        [self.navigationController setNavigationBarHidden:self.hideNavBarOnClose animated:animated];
    }
}

Could you please move your code

    if (self.navigationController) {
        self.hideToolbarOnClose = self.navigationController.toolbarHidden;
        self.hideNavBarOnClose  = self.navigationBar.hidden;
    }

to the viewWillAppear: method ?

Thanx in advance

TimOliver commented 8 years ago

Thanks for that! Done! :)