Uinavigationcontroller + Uiscrollview combination, view Size setting Quest (ii)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.