layout - UIScrollView messes up its subviews -
i have got uiscrollview subviews. subviews can expanded , folded. when uiscrollview loads, subviews folded , there no need uiscrollview enable scrolling. when expand subview, subviews under expanded subview moves down. can happen content size of uiscrollview not large enough when subviews expanded. try update contentsize this:
`float scrollviewsizeheight = ingredientsview.frame.size.height + recipeview.frame.size.height + tasteview.frame.size.height + nutritionview.frame.size.height + 300;
if (scrollviewsizeheight > scrollview.frame.size.height) { [scrollview setcontentsize:cgsizemake(scrollview.frame.size.width, scrollviewsizeheight)]; [scrollview setneedsdisplay]; }`
new code tag weird -.-
but when happens, subviews collapse , positions messed up. idea why?
just deactivate autolayout in ib
Comments
Post a Comment