2

I have a UITableview where I use viewForHeaderInSection method to customize the view like a drop down so when I select the particular button on the section header view the cell for row appears like a drop down. I need a way such that when I select the particular section this section should go to the top of the tableview.

Is there a solution to implement this?

4

1 回答 1

0

首先根据下拉选择获取部分。

CGRect rect = [tableView rectForHeaderInSection:(NSInteger)section];

[tableView setContentOffset:CGPointMake(0.0, rect.origin.y)
             animated:YES];  

[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section]                                                
               atScrollPosition:UITableViewScrollPositionTop
                       animated:YES];
于 2013-09-27T10:15:21.097 回答