2011-09-12 4 views
0

세로 및 가로 모드를 변경하면 테이블의 너비가 조정됩니다. 테이블보기가 그룹화됩니다. 진행 표시기의 너비를 변경하려면 contentView 너비를 계산해야합니다. 나는UITableView 그룹화 - 회전 후 셀 콘텐트의 너비를 얻는 방법

float contentWidth = [tableView cellForRowAtIndexPath:indexPath].contentView.frame.size.width; 

을 시도하고있다 그러나 나타나서 회전 후 스크롤 한 후 변경하는 이전 값을 제공합니다. 를 구성 할 때

답변

1

float contentWidth = [tableView cellForRowAtIndexPath:indexPath].contentView.bounds.size.width; 

을 시도하거나 당신은 당신의 진행 상태에 대한 autoresizingMask 적절한 설정할 수 있습니다

progressIndicator.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; 
+0

감사합니다. 경계에 대해 잊어 버렸습니다.이 방법도 확인해 보겠습니다. – Michael

0

당신은있는 tableView를 다시로드 할 수 있습니다 회전이 아래의 방법을 사용하여 완료 후 :

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 

    [self.tableView reloadData]; 

} 

이렇게하면 새로운 값을 얻을 수 있습니다.

+0

고맙습니다. 컴퓨터에 연결하자 마자 시도해 보겠습니다. 그러나 표보기가로드 될 때 콘텐츠보기 너비가 그룹화 된 셀의 보이는 너비보다 적습니다. 프론트 펜촉이 장착 된 것 같습니다. – Michael