iphone - setContentOffset on UIScrollView the right way -


i'm using code scroll uiscrollview down because i'm adding new uiview on bottom , want scroll down it. this:

cgpoint newoffset = cgpointmake(mainscrollview.contentoffset.x, mainscrollview.contentoffset.y + floorf(bottomattachmentview.frame.size.height / bottomattachmentview.multfactor)); [mainscrollview setcontentoffset:newoffset animated:yes]; 

i add new element's height y of uiscrollview's contentoffset scrolls out of scrollview contentsize, lower, possible scroll. happens because modify contentsize before calling method above , height of scroll view shrinks.

how call setcontentoffset wouldn't make scrollview scroll out of it's own contentsize? thanks!

all had actually, scroll uiscrollview bottom this:

cgpoint bottomoffset = cgpointmake(0, [mainscrollview contentsize].height - mainscrollview.frame.size.height); [mainscrollview setcontentoffset:bottomoffset animated:yes]; 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -