Question

I have UIScrollView that is a subview on my view controller, in this scroll view I have UIView on top (the blue square) and a UITableView on the bottom (the light grey square). I also have a UIView that is acting like NavigationBar (the dark blue color bar), he is outside of the scroll view.

The view controller hirarchy is:

- view
  - UINavigationBar
  - UIView (as navigation bar)
  - UIScrollView
    - UIView
    - UITableView

My problem is that something pushs the UIScrollView scroller down, but the UIScrollView y is where it should be, I don't know what causing it, also tried every AutoResizing mask combination, but without success, it just won't move. I also canceld AutoResizingSubviews and set AutoResizingMask to UIViewAutoResizingNone.

In the picture the scrollview is scrolled all the way to the top, you can see that the scroller itself is located down from the scrollview top. also I have a spare in the bottom exactly as the size of the padding in top.

What can I do to fix it?

scroller

Was it helpful?

Solution

In iOS 7 and xcode 5 there is new property for viewcontroller that perform such action, if dont want to see that you have to uncheck that property and then the scrollview will work fine. enter image description here

In the layout section, uncheck the Adjust Scroll View Insets option and viola it will work just fine

Update: Use this code.

self.edgesForExtendedLayout=UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars=NO;
self.automaticallyAdjustsScrollViewInsets=NO;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top