Wednesday, 15 January 2014

ios - UIScrollView scroll down -



ios - UIScrollView scroll down -

i scrolling downwards uiscrollview using method:

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

the point if content in uisecollview more actual size of scroll view works fine, otherwise if have less content method hides in scroll view. how can stop this?

why scroll if it's short scroll? instead, check see if content size taller scroll view size:

if (self.scrollforcomments.contentsize.height > self.scrollforcomments.bounds.size.height) { // if is, run code cgpoint bottomoffset = cgpointmake(0, self.scrollforcomments.contentsize.height - self.scrollforcomments.bounds.size.height); [self.scrollforcomments setcontentoffset:bottomoffset animated:yes]; } else { // if not, either nil or scroll top }

ios xcode uiscrollview

No comments:

Post a Comment