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.

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
Post a Comment