How to programmatically have UITableView scroll to a specific section

前端 未结 6 1417
离开以前
离开以前 2021-02-13 20:40

In my calendar app, I want my UITableView to scroll to a specific section based on which date is tapped. Current implementation is below:

- (void)calendarDidDate         


        
6条回答
  •  感情败类
    2021-02-13 21:23

    Row is must be int value and that variable define in .h and use this variable in anywhere in .m class that you are want to scroll on particular position.

    You can scroll UITableView on particular section and also you can scroll to section's particular index cell using following code:

    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
    [MytblView scrollToRowAtIndexPath:indexPath 
                         atScrollPosition:UITableViewScrollPositionTop 
                                 animated:YES];
    

提交回复
热议问题