Swift calling setNavigationBarHidden but view wont move to top
Try this code...
Note: This is a simple approach for your problem. If you want more custom look navBar and status bar look .You should read my previous comment...
Set navigation controller property hidesBarsOnSwipe to true
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
navigationController?.hidesBarsOnSwipe = true
}
setNavigationBarHidden not working from other class (Swift 3.0)
Note: Below answer based on the conversation between the question owner and myself.
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
if(velocity.y>0) {
UIView.animate(withDuration: 2.5, delay: 0, options: UIViewAnimationOptions(), animations: {
self.navigationController?.setNavigationBarHidden(true, animated: true)
}, completion: nil)
} else {
UIView.animate(withDuration: 2.5, delay: 0, options: UIViewAnimationOptions(), animations: {
self.navigationController?.setNavigationBarHidden(false, animated: true)
}, completion: nil)
}
No Swipe Back when hiding Navigation Bar in UINavigationController
A hack that is working is to set the interactivePopGestureRecognizer
's delegate of the UINavigationController
to nil
like this:
[self.navigationController.interactivePopGestureRecognizer setDelegate:nil];
But in some situations it could create strange effects.
swift hiding navigationbar and adding a custom back button not sure if I am doing it right
Simulated metrics are just that - simulated. They have no effect on the application.
In the second VC viewDidLoad put
self.navigationController?.setNavigationBarHidden(true, animated: false)
How to hide a navigation bar from first ViewController in Swift?
If you know that all other views should have the bar visible, you could use viewWillDisappear
to set it to visible again.
In Swift:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(true, animated: animated)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.setNavigationBarHidden(false, animated: animated)
}
Related Topics
Add View as a Parameter to a Custom Viewmodifier
How to Update a Sent Message in Quickblox iOS
Swiftui Card Flip Animation with Two Views, One of Which Is Embedded Within a Stack
Using Simple Ping in Swift (Ios)
Generics Type Constraint VS Inheritance
iOS Mkmapview Custom Images Display on Top Left Corner
How to Change Uinavigationbar Per View Controller
Center Horizontal Uicollectionview Based on Content
Save Uiimage Array in Nsuserdefaults
Dyld: Symbol Not Found: _Tmpdcss12Anygenerator
How to Properly Refresh a Uinavigationbar
How to Download and View Images from the New Firebase Storage
Swift 2 - Separating an Array into a Dictionary with Keys from a to Z
Could Not Cast Value of Type 'Nsnull' (0X10Aa1B600) to 'Nsstring' (0X10B4Dab48)
Get Light or Dark Variant of a Color Declared in Assets
Firebase: Provided Bucket Does Not Match the Storage Bucket of the Current Instance in Swift