ios - UIScrollView starts out halfway down content -
this question has answer here:
i trying implement uiscrollview in similar fashion featured banner @ top of app store. adding 3 views , paging through them using code below. when controller loads however, started content down bit. if tap on view content goes should be. how can fix this? i've trying setting content offset 0, i've tried manually scrolling origin rect, , i've tried putting views in content view, nothing has worked.
featuredscrollview.alwaysbouncevertical = false featuredscrollview.contentsize = cgsize(width: 3 * featuredscrollview.frame.size.width, height: featuredscrollview.frame.size.height) let contentview = uiview(frame: cgrect(x: 0, y: 0, width: 3 * featuredscrollview.frame.size.width, height: featuredscrollview.frame.size.height)) featuredscrollview.addsubview(contentview) in 0..<3 { let testview = uiview(frame: cgrect(x: cgfloat(i) * featuredscrollview.bounds.size.width, y: 0, width: featuredscrollview.bounds.size.width, height: featuredscrollview.bounds.size.height)) testview.backgroundcolor = .blue testview.layer.bordercolor = uicolor.white.cgcolor testview.layer.borderwidth = 1 contentview.addsubview(testview) }
did try set automaticallyadjustsscrollviewinsets
no
?
Comments
Post a Comment