2013-05-08 2 views
4

축제에 대한 라인업을 만들고 싶습니다. 아래에서 내가 달성하고자하는 것을 볼 수 있습니다. enter image description hereUITableview에서 가로 및 세로 스크롤

수평 - 수직 및 왼쪽에서 오른쪽으로 스크롤 할 수 있습니다 (영어로 적절한 단어를 모르는 경우). 한 섹션에서 스크롤하면 다른 섹션도 함께 스크롤해야합니다.

내 질문에 어떻게 할 수 있습니까? 이 작업을 얻을 수있는 일을 찾고 있지만 좋은 해결책을 찾을 수 없습니다 ...

+0

수평에만있는 UITableViewCell, 즉 한 번에 하나의 행 또는 전체 jQuery과 – Bonnie

+0

이 작동하지만 테이블 부하 모든 모든 행의 원인이됩니다 전체의 tableview – Steaphann

답변

4

UITableView의 행 자체를 UITableView 내에서 스크롤하지 않습니다. 한 가지 해결책은 UIScrollView를 사용하고 내부에 UITableView를 추가하는 것입니다. 이 UIScrollView의 크기는 UITableView의 크기와 동일하지만 UIScrollView contentSize 속성의 높이는 같지만 너비가 더 넓습니다.

enter image description here

jQuery과 더 나은 이해를 위해
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(x, x, x, x) style:...] 

[scrollView addSubview:tableView]; 

// Set the size of your table to be the size of it's contents 
// (since the outer scroll view will handle the scrolling). 
CGRect tableFrame = tableView.frame; 
tableFrame.size.height = tableView.contentSize.height; 
tableFrame.size.width = tableView.contentSize.width; // if you would allow horiz scrolling 
tableView.frame = tableFrame; 

// Set the content size of your scroll view to be the content size of your 
// table view + whatever else you have in the scroll view. 
// For the purposes of this example, I'm assuming the table view is in there alone. 
scrollView.contentSize = tableView.contentSize; 
+0

스크롤에 당신이 원하는 할, 그래서 긴 목록에 적합하지입니다 . tableview의 프레임을 scrollview의 범위와 동일하게 만드십시오. scrollview는 가로 스크롤링을 수행하므로 contentSize.width가 화면보다 넓으며 tableview는 세로 스크롤링 (행 수에 따라 다름)을 수행합니다. –

+0

u가 더 나은 솔루션을 발견했습니다. pls 공유하고 있습니다. –

관련 문제