ios - UIScrollview is not scrolling -


i know there tens of similar question scrollview have tried everything, scrollview not scrolling.

first created uiviewcontroller xib file, , set freeform , arrange size of , added scrollview on view.

enter image description here

then added childviewcontroller view controller.

-(void)scrollviewsetup {     if (!_scrollview) {         _scrollview=[[uiview alloc] initwithframe:cgrectmake(0,200,self.scrollview.frame.size.width,200)];         [self.view addsubview:_scrollview];          scrollview *displayportf=[[scrollview alloc] init];         //add child view controller here         //displayportf.delegate=(id)self;         [_scrollview addsubview:displayportf.view];         [displayportf didmovetoparentviewcontroller:self];         [self addchildviewcontroller:displayportf];     } } 

content size of scroll view (768,200) on ipad. tried setting content size (1920,200) in viewdidload didn't work viewdidappear didn't work viewdidlayoutsubviews didn't work.

then checked use auto layout box , tried add constants goingeditor->resolve auto layout issues->add constraints

how can make scrollview scroll?

note: parent view uses auto layout , storyboard.

i guess reason of issue 0 width of scrollview.
when call this:

_scrollview=[[uiview alloc] initwithframe:cgrectmake(0,200,self.scrollview.frame.size.width,200)]; 

_scrollview initiated width self.scrollview.frame.size.width, @ moment self.scrollview nil related instance variable _scrollview hasn't initiated yet.

try set non 0 float value view width:
_scrollview=[[uiview alloc] initwithframe:cgrectmake(0,200,768,200)];


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -