2014-07-17 2 views
0

높이가 77 인 사용자 정의 셀을 사용하여 UITableViewCellUITableView이 있습니다. 마지막 행이 잘리지 않더라도 모든 방법으로 스크롤 할 수 없습니다.UITableViewCell의 UITableView가 아래로 스크롤되지 않습니다.

이 코드를 사용하여 테이블보기의 프레임을 만듭니다.

사람이 내가 제대로 경로를 스크롤 할 수있는 방법 어떤 제안이 있습니까 : 여기

CGRect screenRect = [[UIScreen mainScreen] bounds]; 
CGFloat screenWidth = screenRect.size.width; 
CGFloat screenHeight = screenRect.size.height; 

_routeTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 50, screenWidth, screenHeight) style:UITableViewStylePlain]; 

내 문제를 보여주는 짧은 video입니까?

마지막 셀을 자르지 않고 셀을 위로 향하게하는 공간이없는 것 같습니다.

-(void)configureRouteTableView 
{ 
    CGRect screenRect = [[UIScreen mainScreen] bounds]; 
    CGFloat screenWidth = screenRect.size.width; 
    CGFloat screenHeight = screenRect.size.height; 

    _routeTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 50, screenWidth, screenHeight - 50) style:UITableViewStylePlain]; 

    _routeTableView.delegate = self; 
    _routeTableView.dataSource = self; 
    _routeTableView.hidden = YES; 
    _routeTableView.separatorColor = [UIColor clearColor]; 
    [_routeTableView setBackgroundColor:[UIColor clearColor]]; 
    [self.contentView addSubview:_routeTableView]; 
} 

답변

1

내 개인적인 경험

1) 확인 스크롤 콘텐츠 크기 jQuery과 셀 크기

2) 확인의 배수가 있는지 확인의 tableview의 y 좌표 플러스의 tableview의 높이가 화면을 초과하지 않습니다.

귀하의 경우 2 위라고 생각합니다. 문제가 발생했습니다. 이후,

_routeTableView = [[UITableView alloc] initWithFrame : CGRectMake (0, 50, screenWidth, screenHeight) 스타일 : UITableViewStylePlain];

50 + screenHeight는 tableview의 일부가 화면에서 벗어난 것을 의미합니다. :)

suggester에게 제안 해 주셔서 감사합니다. 왜 편집을 사용하지 못하는지 잘 모르겠습니다.

1) 먼저 jQuery과의 프레임을 조정 : 당신이이 문제를 해결하려면 두 가지 옵션이 있습니다시피

+0

테이블보기가 중지 제목 및 거리 레이블 위에 있기 때문에 50으로 설정하는 이유입니다. – user3741418

+0

"CGRectMake (0, 50, screenWidth, screenHeight-50)"을 사용해야합니다. 그 여분의 50은 화면 높이를 넘었습니다. screenHeight-50으로 설정하면됩니다. :) –

+0

나는 그 이상의 시가를 시험해 보았다. 마지막 열을 자르지 않고 위쪽으로 스크롤 공간을 더 확보했다. – user3741418

2

테이블 뷰의 높이를 의미

_routeTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.navigationController.navigationBar.frame.size.height, screenWidth, screenHeight - self.navigationController.navigationBar.frame.size.height) style:UITableViewStylePlain];

높이입니다 화면에서 탐색 바 높이를 뺀 다음 Y 축의 탐색 바 직후에 시작합니다.

2) UITableView의 바닥 글에 약간의 높이를 지정하십시오. (권장하지 않음)

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { return 50.0f; }

또한 확인하시기 바랍니다이 위임 기능은 실제 셀 높이를 반환해야 :

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    return yourTableCellHeight; 
} 
+0

문제를 해결하지 못했지만 붙여 넣은 코드는 셀의 sub tableview를 참조했습니다. 스크롤 할 수 있도록 테이블보기 위에 '공간'이없는 것 같습니다. – user3741418

0

I가 프레임 라인을 변경하는 데 필요한 :

_routeTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 50, screenWidth, 90) style:UITableViewStylePlain]; 
+0

귀하의 질문은 귀하가 성취하고자하는 것을 매우 혼란 스럽습니다. 게다가 난 하드 코딩 된 값을 선호하지 않는다. 계산을 해보고 50과 90의 값을 얻으려고한다. 그래서이 앱이 iPad 나 다른 장치로 간다면 IF ... ELSE ... (가능하다면) – NeverHopeless

0

를하시기 바랍니다 다음 메소드에서 tableview 셀 높이를 설정하십시오.

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 

{ 
    return height;//77 

} 
0

tableview의 contentInsets를 사용해보십시오. IB로 설정할 수 있습니다. 하지만 먼저 자동 레이아웃을 비활성화하십시오.당신이 Podfile를 사용하는 경우

, UIView+Autolayout 설치 :

pod 'UIView+Autolayout' 

UIView의-Autolayout.h을 포함
0

내가 대신 아이폰 OS가 (잘못된) 일을시키는이 사용하는 자동 레이아웃 제약 조건을 고정
#import "UIView-Autolayout.h" 

귀하의 viewDidLoad에서 이것을 사용하십시오 :

[tableView setTranslatesAutoresizingMaskIntoConstraints:NO]; 
[tableView pinToSuperviewEdges:JRTViewPinAllEdges inset:0.0]; 
관련 문제