ios - Scrollview come back on same position in up and down direction whenever leave scrolling -


i using uiscrollview , set it's content size same view's height.

i need make scrollview scrolls same in both side (up / down).

it come in same position mean whenever scrolls in top direction , leave scrolling come y = 20 pixels when scroll in bottom direction come on 20 pixels when leave scrolling...

for setting scrollview content size

 cgsize scrollviewcontentsize = cgsizemake(self.view.frame.size.width, self.view.frame.size.height); [self.scrollviewbg setcontentsize:scrollviewcontentsize]; 

also have tried give content offset

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

but not solved problem.

i updated , make scrollview's height similar view's height , increase it's content height , solved problem.

-(void)viewdidappear:(bool)animated{  float space = 2.5; // making scroll view scrolls , on same positions both sides.  cgsize scrollviewcontentsize = cgsizemake(self.view.frame.size.width, self.view.frame.size.height+space); [self.scrollviewbg setcontentsize:scrollviewcontentsize]; [scrollviewbg setcontentoffset:cgpointmake(0, 0) animated:yes]; 

}


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -