ios - Reset Scroll View when returning from View Controller -


uiscrolview noob here..

i have 2 view controllers.

first view controller contains long image view embedded in ui view embedded in scroll view.

image view has button @ top , @ bottom. both buttons lead next view.

scroll working can scroll bottom of image , top.

when top button clicked taken next view...then button there can return first view , can continue scrolling down , up.

problem occurs when bottom button clicked , return next view.

i cannot scroll upwards , can see bottom part of image.

by looking online ive found 2 potential solutions, of neither work me:

sol1: [self.scrollviewfront scrollrecttovisible:cgrectmake(0, 0, 1, 1) animated:no];

sol2: [scrollviewfront setcontentoffset:cgpointmake(0,0) animated:yes];

my scroll view contentsize set follows:

self.scrollviewfront.contentsize = cgsizemake(320, 775);

there must way can return top half of image instead of being stuck towards bottom.

thanks help.

i suspect issue not scrollview, transition or second next view. try swapping actions associated buttons. transitioning view associated top button work if associated bottom instead?


Comments