1

I have an array of data with past and future events. when page load time the tableview scroll to the first future events. scroll down time shows the past events

-(void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    NSInteger index = 0;
    if ([arryIndex count]!=0) {
        NSNumber * indexPathData = [arryIndex objectAtIndex:index];
        int number = [indexPathData intValue];
        [tableEvents setContentOffset:CGPointMake(0.0, tableEvents.contentSize.height - tableEvents.bounds.size.height)animated:YES];
        [tableEvents scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:number inSection:0]atScrollPosition:UITableViewScrollPositionTop animated:YES];
    }
}
ink
  • 519
  • 6
  • 19
Manju SSP
  • 63
  • 6

1 Answers1

0

check answer in this Link How to scroll UITableView to specific position

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:YourIndex inSection:0];
[YourTableView scrollToRowAtIndexPath:indexPath 
                 atScrollPosition: UITableViewScrollPositionMiddle 
                         animated:YES];
Chetan Hedamba
  • 293
  • 2
  • 9