1

I have a UITabBarController with one UINavigationController holding a UIViewController as root view controller.

when tapping one of the button in the UIViewController, I push a regular chat window UIViewController (with TableView + Input View) end hiding the bottom tab bar. (using the "Hide bottom bar when pushed" flag)

In storyboard I added a regular UIView subclass to VC that look like a bottom bar, and I use Auto Layout to pin it to the bottom of the VC view.

The problem when I push VC it takes a second for this view to pin to the bottom, it looks like auto layout pin it to the bottom as if the tab bar is not hidden and after a sec it recognise that the tab bar is hidden and moves it to the real bottom of the view.

For clear info check this screen shot

enter image description here

Now I will let you the know the constraints of the table view.. enter image description here

Now I am showing the constraints of the InputView enter image description here

I am also adding my View hierarchy...

enter image description here

Deepakraj Murugesan
  • 1,195
  • 11
  • 30

1 Answers1

5

I had a similar issue in my project. I solved it by selecting the view I wanted anchored to the bottom (in your case, the input view), held Command, and selected its superview (both views should be highlighted now).

enter image description here

Then I selected the align button at the bottom of IB:

enter image description here

And added a Bottom Edges constraint.

What I had done initially is used the pin menu to pin the view to its superview, but it appears that will pin it to the bottom layout by default, which causes that weird movement during the transition.

EDIT:

After seeing the latest screenshot, the problem could lie in one of the superviews. I'm assuming that chatWindow is a UIView, and your Scroll View is horizontal only. Here's what your should check:

  1. chatWindow is pinned to the scrollView's bottom similar to what I've outlined above.
  2. scrollView is pinned to its superview as I've outlined above.
  3. Moving the inputView outside of the scrollView to the root superview. Then one by one move it down the hierarchy towards its current location.
Mark
  • 7,167
  • 4
  • 44
  • 68
  • Can you show me your view hierarchy? It may be that your inputView's superview is not the root view, and the problem is higher up in the hierarchy. – Mark Feb 15 '16 at 14:51
  • yes can u have a look on the view hierarchy @mark... I have posted the screen shot – Deepakraj Murugesan Feb 15 '16 at 14:54
  • I've added a few suggestions to help you debug the issue. My blind guess is the scrollview is implicitly applying some sort of inset in order to compensate for the tab bar. – Mark Feb 15 '16 at 15:04
  • Yeah @Mark, I have exactly did how you explained but still I can't figure it out where I'm getting struck.. I have uploaded the storyboard with this viewcontroller alone [Autolayout]. When this story board is added with tab bar then the Bottom bar gap is happening... this is the link have a look on it... https://www.dropbox.com/s/zqy1e2tvezbr8hr/Main.storyboard?dl=0 – Deepakraj Murugesan Feb 15 '16 at 16:38
  • I've downloaded your storyboard. It looks like the scrollView is constrained to the bottom layout of its superview (which will cause that weird transition with the tab bar). I've made the change to the storyboard here: https://www.dropbox.com/s/gu0i9l5d7caq5ww/Main-revised.storyboard?dl=0 – Mark Feb 15 '16 at 17:24
  • Thank you so much @Mark... You saved my day man... It worked like charm... I fixed it – Deepakraj Murugesan Feb 16 '16 at 05:51