When you add a Uiscrollviewcontroller directly to a navigation under a Uiviewcontroller, Uiscrollview automatically offsets 20 points (which may be offset by 64 points, 84 points)-(depending on your settings, it will be offset anyway), resulting in a comparison of the reasons, but the solution is simple:
Solution:
Do not put Uiscrollview directly on the controller, you can first create an unrelated uiview to do cannon fodder;
In the place to put Uiscrollview, first put on cannon fodder UIView
There is UIView point cushion back, and then put Uiscrollview on the top will not be offset;
The detailed code is as follows:
#pragmaMark-viewdidload-(void) viewdidload {[Super viewdidload]; //self.automaticallyadjustsscrollviewinsets = NO;//Self.navigationController.navigationBarHidden = YES; ///Viewback solve the problem of automatic migration of Totalview (Cannon view)UIView * Viewback = [[UIView alloc] Initwithframe:cgrectmake (0, -, -, -)]; Viewback.backgroundcolor=[Uicolor Greencolor]; Self.totalScrollView.backgroundColor=[Uicolor Purplecolor]; [Self.view Addsubview:viewback]; [Self.view AddSubview:self.totalScrollView];
ScrollView Initialization by lazy loading
_totalscrollview = [[Uiscrollview alloc] Initwithframe:cgrectmake (0, 64, 375, 667)]; }
In iOS: Problem solving for automatic offset of Uiscrollview in navigation controller