I am new to objective-C programming.
I am using UIScrollView with some labels, image and text view on it.
I have turned off Autolayout and already tried with "Adjust scroll View Insets" on (situation described in title) and off (doesn't scroll).
This is what I insert into viewDidLoad:
[scroller setScrollEnabled:YES];
[scroller setContentSize:CGSizeMake(320, 687)];
But I must be missing something very simple.
iOS 11
Actually, the margin has nothing to do with
ScrollViewInsets
orcontentOffset
. It's just a conflict betweenSuperView.Top
andSafeArea.Top
pinning, happens when you pin the UIScrollView to top, bottom, left and right.This is the right way to cover the top margin.
1) Pin all the four sides.
2) Select the top constraint > Change Second Item to
Superview.Top
3) Then the last step is to change the Constant to 0 (Zero).
You might want to check this too: https://github.com/29satnam/MoveTextFieldWhenKeyboardAppearsSwift
iOS 11
In my case only changing this UIScrollView Content Insets property in IB from
Automatic
toNever
helped.In your view .m file, use this code to fix this problem