Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I searched a lot for this answer but ultimately had to come up with one of my own. You can call the method scrollAutomatically with the starting row number like:</p> <pre><code>[self scrollAutomatically:0]; </code></pre> <p>So this is what the function looked like. I was dealing with a table which always had 3000 rows and I intended to scroll to the bottom.</p> <pre><code>- (void) scrollAutomatically:(int) i { __block int j = i; [UIView animateWithDuration: 0//Change this to something more for slower scrolls animations: ^{ [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:j inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO]; } completion: ^(BOOL finished){ j = j + 10;//Changing this number affects speed. if(j&lt;=2999)//here you could provide the index of destination row [self scrollAutomatically:j]; else { //I had some code here that popped up a UIAlertView. } }]; } </code></pre> <p>Now coming to the speed of the scroll. </p> <p>FOR REALLY FAST SCROLLS:</p> <p>If I set value by which I increment the row index (j) on each call of the function to 10, i.e. if I write <code>j = j+10;</code> then my 3000 rows took about 9 seconds to scroll. (3000 * mean FPS that I could muster). If I set it to <code>j = j+20;</code> then the 3000 rows took about 4.5 seconds. So you get the idea. To make it scroll slower reduce the increment value.</p> <p>FOR SLOW, READABLE SCROLLS:</p> <pre><code>[UIView animateWithDuration: 1.5//this will directly set your speed. n rows scrolled every 1.5 seconds. </code></pre> <p>NOTE: If you change frames of CALayers or Views (eg. a customView you may have added to the contentView of your tableViewCell), then those animations will start to bother you here. For a large animation duration, they will be very visible and you may see strange cell beahviour.</p> <p>In that case wherever you change your frames etc. look at something like:</p> <pre><code>[CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; [myView.myCALayer.frame = (CGRect){ { 10, 10 }, { 100, 100 } ]; [CATransaction commit]; </code></pre> <p>Find the above solution <a href="https://stackoverflow.com/questions/12103142/calayer-animates-with-frame-change">here</a>.</p> <p>You may also have to set the actions dictionary for the layer to return nulls for all actions.</p> <pre><code>NSMutableDictionary *newActions = [[NSMutableDictionary alloc] initWithObjectsAndKeys:[NSNull null], @"sublayers", nil]; superlayer.actions = newActions; </code></pre> <p>This seems to be too late but for people facing the same problem I hope this answer will be helpful. Also please feel free to guide me in case I have made some obvious (or not so much) blunder.</p> <p>Edit: Oops, I see the exact thing above my answer :( Anyways, this is a bit more detailed and I am only a beginner :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload