I added these 2 keys to hide status bar:
Status bar is initially hidden = YES
View controller-based status bar appearance = NO
It works great, but I realize that when clicking on the status bar area, we can actually click through the view underneath.
I have a UICollectionView behind the status bar area, and I can actually click on the collection cell. In the picture below, Cell #12 is right above Cell #16, and we can actually tap on upper right corner to trigger didSelectCell(atIndexPath.
How do I disable this "click through" behavior, and bring back the "auto scroll to top" behavior when tapping on status bar?
Try setting the UICollectionView top constraint to be constrained to the parent view safeAreaTopAnchor instead of the parent view topAnchor. That way you have the UICollectionView out of the way of the statusbar
Related
iOS 10, xcode 9.2
as the image shows, the statusbar hides in the front viewcontroller or window? but shows on the back viewcontroller.
i have tried hide statusbar, but both viewcontroller will hide the status.
Actually it's not hidden the background of menu view is white like labels on status bar
bottom view controller is pinned to topLayoutGuide.bottom = 0
top view controller is pinned to superView = 0
see here
after click button
I'm having issues with the navigation bar, I want to set a view controller where there is a scroll view with its content, but I'm having a weird behavior that when I scroll down the navigation bar hides kind of scrolling with the scroll view but the navigation bar is not inside that.
My Scroll view has a vertical spacing to the top to avoid going upper that I want and hiding the navigation bar but it still happens.
Any help will be appreciated.
Have you tried to set hidesBarsOnSwipe = false for the navigation contrller.
More info from Apple api reference
I've got a gradient background that I want to show through both the navigation bar and the tab bar. I have them set to "translucent black". If I create a ViewController and put a TableView on it, this works perfectly. However, I can't get it to work properly with a TableViewController. The tab bar works fine, but the navigation bar ends up black. If I turn off "Adjust Scroll View Insets", then the navigation bar looks the way I want it, but the top half of the first table view row gets cut off (see examples). The gradient is on the background view. The background colour of the tableview is clear.
Is there any way to get the same effect on a TableViewController? Do I need to somehow make the heading or first row of the tableview be the background that goes under the nav bar?
ViewController with TableView added:
TableViewController with "Adjust Scroll View Insets" ON:
TableViewController with "Adjust Scroll View Insets" OFF:
After doing a test I think you'd need:
Adjusts Scroll View Insets ON
Extend Edges - Under Top Bars ON
No. 1 allow the UITableView to cover the entire screen (including under the navigation bar) and No. 2 adds a space at the top of the UITableView content so that the content is not hidden under the navigation bar.
I ran into a similar issue trying to set a full screen background on a static table view controller with a clear navigation bar. I solved it by using a backgroundView on my tableView instead of setting backgroundColor. For example:
myTableView.backgroundView = UIImageView(image: UIImage(named: "backgroundImg.png"))
I set my navigation bar to clear, but you could style that however you like:
navigationController?.navigationBar.backgroundColor = UIColor.clear
I also had to set Extend Edges - Under Top Bars ON
I am trying to create a bottom toolbar. So I dragged I Bar Button Item to the View Controller and it was automatically position at the bottom, see image below:
But when I run the app, it doesn't show the bar at the bottom.
I already added:self.navigationController?.navigationBarHidden = false
I think it's just only a constraints problem.
First of all check your Document Outline near to the left of your table, to see the position (toolbar is just below table):
Add your constraints and pay attention to all options as shown in the picture:
Then, take a look to the size inspector, for the table view:
And for the toolbar:
This configuration working both in portrait/landscape mode.
Drag UIToolbar controller directly instead of only UIBarbutton item.
self.navigationController?.navigationBar.hidden=false
Have you set constraints of UIToolbar? I just guess it can be one of the reasons why you cannot see your barbuttoitem.
The navigation bar and the toolbar are two different things and the toolbar is hidden by default. Try setting the toolbar hidden attribute to false.
Sometimes bar button item and bar button do not show when we present our screen. On screen we can then not see bar button item and bar button. So we need to push our screen if we want bar button item and rightBarButtonItem.
I've read a few questions here and searched around a bit but nothing seems to solve my problem. I have a side navigation controller of which I am sliding the status bar (using a technique outlined here: Moving status bar in iOS 7).
In any event, when I hide the status bar to begin the slide (as soon as I tell the view to hide the status bar and add a fake one), the entire view moves up behind my faux status bar. Is there any way to move the view down so that the faux status bar appears directly above the view?
may be some autolayout issueAs there is no status bar , the view frame went to frame.origin.y=0. Try setting the frame to origin.y=20 before you hide the status bar.
If you are adding fake status bar as subview to mainView. set frame of fake status bar view to (origin.y=-20)