How to build full-screen scrollview and hide nav bar without moving anything - ios

If you look at a photo fullscreen in the iOS 7 photos app, the nav bar and toolbar fade away but the underlying scrollview isn't scaled or shifted. I've been trying to recreate the effect in Interface Builder using autolayout but every time I hide the nav bar it pulls the scrollview up.
What I start with:
What happens:
What I want to happen:
Has anyone implemented this before? It seems like no combination of autolayout constraints, scrollview insets, and automaticallyadjustscrollviewinsets is giving me what i want.

Related

How to anchor an UIView to the bottom of layout (with in-call status bar)

Created a custom tab bar and while trying to anchor it to the bottom of my UIViewController found that the in-call status bar moves the bottom anchor weirdly.
To demonstrate my problem, I create a fresh iOS project, put an label in the Main.storyboard and constrain it to the view's bottom.
Then, when I run the project and toggle the in-call status bar, this happens (label in bottom left corner)
Searched already 2 days on the internet for an answer, but couldn't find anything which is relatable... I get it that the view gets resized, but I would still expect that my label shouldn't move. So is there a way to disable this choppy resize movement or how does the UITabBarController, with its TabBar, avoid this?

scroll top navigation bar similiar to flipkart app ios

I have a logo on a navigation bar. Beneath it, I have a searchbar with three bar buttons on its both sides.
The searchbar and bar buttons are put in a UIView which is beneath the navigationbar.
I want to implement a functionality where with a very small pinch of scroll on the tableview by user, the navigationbar should move above with animation with scroll up and should come down with animation for scroll down.
Along with this, the searchbar should occupy the position of the logo while scrolling up and should come at its original position when scrolling down.
This is the same functionality implemented in Flipkart app on the Home page.
I tried using SQTShyNavigationBar by Cocoa Controls
https://github.com/cbpowell/SQTShyNavigationBar, but that does not adjust the position of my search View.
Please help me with this.

Xcode uiscrollview shows up behind nav bar in IB

Trying to set up a scrollview in a UIViewController that has a nav bar. In IB my content gets pushed up to the top below the nav bar (see image).
When running the app on my phone the view is pushed down to sit below the nav bar which is fine. Is there anyway to get it to reflect like this in IB. It is hard to set up my content when half of it is cut off.
If I add a constraint to make the top of the view sit below the nav bar when I run the app it adds that offset and doesn't look correct. (I guess I could alter the constraint before running on my phone but seems like a ridiculous hack just to layout my app). (Already having major issues getting my scrollView to work the way I want it to... don't scroll if my content fits the screen but also use the scroll view to move the view up if the content is covered up by the keyboard but thats for another post)
when I run in simulator looks like this
In Interface Builder you should make sure your NavigationBar is set to Opaque in the simulated metrics. When you have a transparent Nav bar content can go underneath it.
It might look right in your app if you have a global attribute applied to make sure all nav bars are not translucent.

How to make Navigation bar height become smaller when UITableView scroll down?

How to make UINavigationBar height become smaller when UITableView scroll down?
And when scroll up, the UINavigationBar height back to normal,
just like what safari does.
Thanks
There are a ton of third party options to create an effect like that. I'd start by looking at this question on SO:
Imitate Facebook hide/show expanding/contracting Navigation Bar

Animate Controls down with change to UINavigationBar

I have a UINavigationController with standard UINavigationBar. When presenting certain UIViewControllers and orientations, the UINavigationBar may or may not appear and it may or may not have a prompt element. This means that the bar height changes frequently.
I have some subviews below the UINavigationBar set with NSLayoutConstraints to topLayoutGuide. It generally lays out as expected, adjusting vertical position of the subviews appropriately based on the height of the UINavigationBar. What it does not do is move the subviews at times when the UINavigationBar is animated after the view is already displayed.
Specifically, coming from a state with UINavigationBar hidden, transition to a UIViewController which does not hide the navigation bar to one which does. The view displays, then navigation bar animates into place. The subviews do not move down. If I rotate the device, every things lays out appropriately again. Only when animating the navigation bar in and out or to display/hide the prompt I not find a hook to reevaluate the constraints.
I tried [self.view updateConstraints] and [self.view updateConstraintsIfNeeded] in various places such as viewDidAppear, viewDidLayoutSubviews. Nothing seems to update that topLayoutConstraint.
I am familiar with edge restraints, translucent navigation bar and other various methods of keeping the entire view from appearing under the navigation bar. I do want to keep view full size and I want the translucent bar so these are not solutions for me. It seems the constraints should handle this automatically, hence the "auto" in auto layout.
To simplify, for recreation, UINavigationController with rootViewcontroller showing normal navigation bar with just a title. In viewDidLoad of the next presented viewController I have [self.navigationContoller setPrompt:self.myPrompt]. The view is presented, when the prompt is set, the navigation bar grows larger. Some labels below the bar are set with relation to topLayoutGuide, which places them correctly initially. I expect they would move down when the bar grows. Rotate device back and forth, they now layout correctly. Pop the viewController and push back to top, repeats as above.
So, it turns out it was all me. After trying all manner of forcing layout updates in all sorts of ways, the solution was to move the [myView setPrompt:myPrompt] out of viewDidLoad and call it in viewDidAppear instead.
Works completely as expected. Navbar grows, subviews shift and shrink as needed. Now I have to hunt down all the experimental code I plastered everywhere trying to do it wrong.

Resources