Animation Delayed for navigationBar "hidesBarOnSwipe" - ios

Hi everyone I have a UITableViewController that hides the navigation bar when the user writes the tableView
navigationController? .hidesBarsOnSwipe = true
When the user shows the navigationBar by scrolling down the tableview, the navigationbar's slide animation appears to be delayed showing a black space between the tableView and the navigation bar
How can you solve this problem?
Here you can see what happens when the navigation bar is shown after the user scrolls down

Maybe you can try in viewDidLoad in your UITableViewController
self.edgesForExtendedLayout = []
Hope it will help you

Related

How to hide UISearchController inside of navigation bar

I want to dismiss/hide UISearchController from navigation bar when I switch tabs, I tried many things, if I set it to nil a black layer is shown in the search space. The settings view controller should not present the UISearch any thoughts?
Without seeing your code, this is what I would do if I wanted to hide my search bar. Use the following code to hide searchBar:
searchBar.isHidden = true
view.backgroundColor = .orange
//.clear? Or whatever colour you want to be there in the background.
//In viewDidLoad put
searchBar.isHidden = false
I was adding only one Navigation Controller to all tabs, I changed it, now for each tab I have an independent navigation controller, so it is solved.

iOS 11 - Weird UINavigationBar and UICollectionView behavior

I have a UINavigationController the root view controller of which is a UIViewController with a UICollectionView. The collection has constraint to the left, right, bottom and top. I've checked the prefersLargeTitles attribute in the UINavigationController, so I have big titles. I expected that, during the scroll, the UINavigationBar would automatically collapse, but I had to disable the large titles in my root view controller and add this line of code in my viewWillAppear :
navigationItem.largeTitleDisplayMode = .automatic
Then, I added also the search bar to the UINavigationBar, in this way :
let searchController = UISearchController.init(searchResultsController: nil)
searchController.searchResultsUpdater = self
navigationItem.searchController = searchController
Everything is perfect, visually.
Now, when I scroll down, the UICollectionView suddenly stick to the UINavigationBar which collapses. When I tap on the status bar to go to the top of the collection, a white space appears between the large title and the status bar. Is there a specific procedure that, for some reason, I'm not following? Do you have any solution?
EDIT:
Here you can find the video of the problem
When you see the collection that sticks to the UINavigationBar I confirm you that it's happening in a unnatural way. The last "bug" happens when I tap on the status bar.

SearchController changes the size of tableView

The size of my tableView mysteriously changes heights when the search controller is active like the images I attached below.
The image in the far left is the initial state. Middle image is when the search controller is active and the last image is when the search controller is dismissed.
I tried setting the content size of the tableview when the search controller is active, in the viewDidLoad, viewWillAppear and viewDidAppear without any luck.
Any idea on how to resolve this problem?
P.S. The items you see are just dummy posts.
Try set edgesForExtendedLayout property to be under Top Bar using code
or storyboard
I solved it by setting the extendedLayOut to 0
self.edgesForExtendedLayout = UIRectEdge.init(rawValue: 0)
However, the status bar was covering the search bar so I hide the status bar when the searchController is active
override var prefersStatusBarHidden: Bool {
return searchController.isActive
}

After NavigationBar Hide on Swipe, Cells appear between HeaderCell & Status Bar for a second

Edit: I tried adding in AppDelegate DidFinishLaunch..
let view: UIView = UIView.init(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.size.width, 25))
view.backgroundColor = UIColor.redColor()
view.alpha = 1
self.window!.rootViewController!.view.addSubview(view)
After I changed the Status Bar to red, I prevented it going under status bar, but I realised that it wasn't just the Status Bar and there was something going on with the Navigation Bar while it gets swiped away. The content cells get shown until 1 seconds after NavBar gets swiped away. After 1 seconds, everything seem nice and no content cell gets over the header cell or status bar.
To clear up the problem, at the time Navigation Bar swipes away, there is a gap forms between Header Cell and status bar, so content cells appear for 1 seconds.
But how can I prevent this 1-2 second bug? It's the header cell that gives a gap for 1-2 seconds. It mostly occur if I swipe/roll the table view down fast.
I am leaving the original question below for the future readers.
Original Question:
I have a TableViewController that has Header & Content cells. I am hiding Navigation Controller on Swipe. However, after hiding Nav Bar, Content cells' content goes under the status bar at the top. Everything else is fine.
Header Cells seem fine, as they stop right below Status Bar.
Extend Edges - Top Bars should be checked for the header cell to stop going under status bar but unfortunately doesn't stop content cell.
I tried:
self.tableView.contentInset = UIEdgeInsetsMake(20, 0, 0, 0).
However, this gives a space between Header Cell & Status Bar (even before the Navigation Bar gets hidden). I want to achieve after hiding the Nav Bar.
self.extendedLayoutIncludesOpaqueBars = false does nothing.
self.automaticallyAdjustsScrollViewInsets = false Using this anchors the HeaderCell to the top of the view so HeaderCell gets positioned under NavigationBar.
self.edgesForExtendedLayout = UIRectEdge.None. Using this made the HeaderCell position itself starting from the top of Status Bar so half of the Header seems under status bar. (Also Navigation Bar - Bar Tint forces to become dull gray ignoring whatever I choose, so not really convenient)
I want to ask
Is there a way to not to make Status Bar opaque & make it solid? (I have the Status Bar - Inherred on Storyboard).
Otherwise, is there a way to prevent this behaviour? Maybe considering status bar solid; or maybe giving the Header Cell a space or position HeaderCell starting under the Status bar after the Navigation Bar gets hidden?
I had no luck getting it with TableViewController, here is my workaround...
Created a new ViewController
Unchecked 'Adjust Scroll View Insets'
Copied the TableView from TableViewController into ViewController's View.
Added constraints to TableView (Top/Bottom/Left -20/Right 20).
In AppDelegate, give white colour to Status Bar.

NavigationBar coincides with status bar when searchDisplayController is activated iOS 7

I have a tableView controller which has a searchbar added to tableHeaderView. When I click on searchBar it animates to cover the screen. However, the view behind gets adjusted and navigationBar overlaps with status bar as shown below:
It adjusts back fine, when the search is cancelled. How to hold the view at the back of searchDisplayController not to overlap the status bar?
fixed by doing: [[[parentFileViewController navigationController] navigationBar] setHidden: YES]; in searchDisplayControllerWillBeginSearch method where parentFileViewController contains the searchBar

Resources