To undertake the above, I would like to change the view layout to the following mode, so that the ScrollView long in the Navigationbar, this will not have the problem of occlusion:
Story board content is as follows, the main is the right view Blue area added ScrollView:
The code for Viewcontroller is as follows:
@interfaceViewcontroller () @property (weak, nonatomic) Iboutlet Uiscrollview*ScrollView, @property (nonatomic, strong) UIView*Viewa, @property (nonatomic, strong) UIView*Viewb;@end...@implementationViewcontroller ...- (void) viewdidload {[Super viewdidload]; CGRect rect=Self.scrollView.bounds; Rect.size.width*=2; Self.scrollView.contentSize=rect.size; Self.scrollView.pagingEnabled=YES; //add two view within Self.scrollviewCGRect Rtviewa =Self.scrollView.bounds; Self.viewa=[[UIView Alloc]initwithframe:rtviewa]; Self.viewA.backgroundColor=[Uicolor Redcolor]; [Self.scrollview AddSubview:self.viewA]; CGRect RTVIEWB=Self.scrollView.bounds; Rtviewb.origin.x+=RtViewA.size.width; SELF.VIEWB=[[UIView ALLOC]INITWITHFRAME:RTVIEWB]; Self.viewB.backgroundColor=[Uicolor Bluecolor]; [Self.scrollview AddSubview:self.viewB];}
The result is more strange, I put scrollview background color yellow, why I give Viewa, VIEWB origin.y The initial value should be 0, but into the scrollview after the next? And the problem with the scroll bar is still unresolved:
When I drag the Viewa upward to the position of origin.y=0, but also can be dragged up, but the height of Viewa has been as high as contentsize, what is the matter?
Uinavigationcontroller + Uiscrollview combination, view Size setting Quest (ii)