Extra top white space since IOS 8 using autolayout and scrollview
Since the new update to IOS8, i have an extra white space over my contentview in my scrollview.
My content view should be centered in my scrollview and it’s work fine on IOS7.
Here is the result :
Here is the storyboard version which doesn’t have white space :
I’m wondering what could cause this extra space, is there anything new in ios8 that will cause my content view to have extra space ?
Maybe i need to change how i layout my view ?
EDIT: My solution was to only uncheck adjust scroll bar inset in my views which had the problem.
However the solution below that i accepted works too.
- How can a get the auto layout size of the UICollectionViewCells in iOS 8? (systemLayoutSizeFittingSize returns size with zero height in iOS 8)
- Simplest way to evenly distribute UIButtons horizontally across width of view controller?
- UIScrollView animation of height and contentOffset “jumps” content from bottom
- Autolayout and Scrollview width fixed to screen (not content)
- Setting constraints to UIScrollView
- Programmatic UIScrollview with Autolayout
4 Solutions Collect From Internet About “Extra top white space since IOS 8 using autolayout and scrollview”
I had this exact same problem, and I came up with two possible solutions, both of which are awful and make me ashamed to be a programmer:
- Constrain the scrollable view’s top to the top of the scroll view, but with a constant of
-64, which is the height of the extra space. I don’t know why.
- Add an empty
UIImageViewas a sibling of the
UIScrollView, and constrain it to be flush with all four sides of the root view.
I’m hoping that it’s just an iOS 8 bug so that I can take out my hack and step down off the ledge.
I faced the same issue in iOS 8, following is solution I found:
– Select View Contoller (in storybord) in which you have added the scroll view
– In “Property Inspector” in “Layout” section un-check “Adjust Scroll View Insets”
Try this at your viewDidLoad for that scrollview:
self.automaticallyAdjustsScrollViewInsets = NO;
untick the Extend Edges: under top bars of the main view and make the top distance of the subview 0 instead of negative value. this works for me.
- Swift – is lazy var thread-safe?
- Changing the name of the committer in Xcode
- UIImage as CAShapeLayer contents
- How to select Multiple images from UIImagePickerController
- Xcode build fails for react-native AwesomeProject
- Xcode and iOS5.1 on iPhone won't work
- Using an NSString in a switch statement
- Convert points from image to UIImageView points, contentMode-aware
- How to debug memory leaks when Leaks instrument does not show them?
- Leak from NSURL and AVAudioPlayer using ARC
- Remote mp3 file taking a lot of time to play in swift ios
- Status bar and navigation bar appear over my view's bounds in iOS 7
- Allow users background music in swift 2.0
- Present View Controller Over current tabBarController with NavigationController
- Application not automatically launching in device and getting error on xcode