2013-09-27 2 views
2

UITableview 어디서 드롭 다운과 같은보기를 사용자 정의하려면 메서드를 사용합니다. 그래서 섹션 헤더 뷰에서 특정 버튼을 선택하면 행에 대한 셀이 드롭과 같이 나타납니다 하위. 나는 특정 섹션을 선택할 때이 섹션이 테이블 뷰의 맨 위로 가야하는 방식이 필요하다.특정 섹션은 테이블 뷰의 맨 위로 이동해야합니다.

구현할 수있는 해결책이 있습니까?

+1

좋은 질문이지만 무엇을 시도해야합니까 ??? https://developer.apple.com/library/ios/samplecode/TableViewUpdates/Introduction/Intro.html – iPatel

+0

을 참조하십시오. 도움이 될 수 있습니다. http://stackoverflow.com/questions/8441922/if-we-click-on-custom -section-header-in-uitableview-then-move-that-section-to-t 또한 http://stackoverflow.com/questions/5353680/iphone-having-selected-cell-move-to-top-of-tom- uitableview – iPatel

답변

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]; 
관련 문제