2013-01-24 2 views
2

프로그래밍 방식으로 scrollview에 tableview를 추가했지만 스크롤하지 않습니다. 동안 나는 XIB를 사용하여 동일한 시도. 하지만 잘 작동합니다. 여기 프로그래밍 방식으로 tablview의 스크롤을 사용할 수 없습니다.

내 코드

CGRect 프레임 = CGRectMake (30 30.0f, 900, 300.0f)이고;

eappTable = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain]; 

eappTable.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; 

eappTable.delegate = self; 

eappTable.dataSource = self; 

eappTable.scrollEnabled = YES; 

eappTable.scrollsToTop = YES; 

[eappTable reloadData]; self.scrollView.contentSize

+0

명시 적으로있는 ScrollView의 콘텐츠 크기를 준 스크롤 – amar

+0

을 가능하게하려고? –

답변

3
eappTable = [[UITableView alloc] nitWithFrame:YourSize style:Table_Style]]; 
eappTable.delegate = self; 
eappTable.dataSource = self; 
eappTable.scrollEnabled = YES; 
[scrollView addSubview:eappTable]; 

그리고 설정 당신은있는 ScrollView의 내용 크기를 설정해야합니다.

희망 하시겠습니까? (모든 셀 크기 jQuery과 크기 그 자체보다 작은 경우 반송가 NO에 설정되는 경우, 이동하지 않기 때문에)

2

[scrollView addSubview:eappTable]; 
2

시도 튀는 활성화하기 :

eappTable.bounces = YES;

0
[eappTable setContentSize:CGSizeMake(320, 680)]; 
0

나는 이것이 당신이 찾고있는 대답이 아니라는 것을 알고 있습니다. 그러나 한 점을 언급하고자합니다 : scrollview의 하위보기로 tableview를 추가하지 마십시오. 중요

: 당신은 UIWebView 또는 UITableViewUIScrollView에서 개체 개체를 포함하지 않아야합니다. 이렇게하면 두 개체의 터치 이벤트가 섞여서 이 잘못 처리 될 수 있기 때문에 예기치 않은 동작 인 이 발생할 수 있습니다. UIWebView Class Reference에서