2012-01-20 2 views
0

UITableView의 컨테이너로 사용되는 특정 크기의 UIView가 있습니다. 내 테이블보기에서 UITableViewCell 하위 클래스를 사용합니다.uitableview의 너비를 사용자 정의 테이블 뷰 셀에 계단식으로 연결하는 방법은 무엇입니까?

문제는 내 사용자 지정 테이블보기 셀이 UITableVIew에서 적절한 너비를 얻을 수 없다는 것입니다. 이것은 테이블 뷰를 만드는 방법입니다. categoryListView = [[UITableView alloc] initWithFrame:categoryListContainer.bounds style:(UITableViewStylePlain)];

이것은 사용자 정의 테이블 뷰 셀을 만드는 방법입니다.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if (tableView == categoryListView) { 

     static NSString *CellIdentifier = @"MenuCategoryListIdentifier"; 

     MenuCategoryListCellView *cell = (MenuCategoryListCellView*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
     if (cell == nil) { 
      // create dynamically 
      cell = [[MenuCategoryListCellView alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:CellIdentifier]; 
     } 
     .... 

나는 내 UI 컨트롤을 끌어 내 MenuCategoryListCellView의 initWithStyle 방법에 대한 올바른 셀 경계를 얻을 수 있기를 바랍니다. 그러나 나는 가치를 어떻게 내릴지 모른다.

도움을 받으실 수 있습니다! 셀 크기를 조정할 때

레오

답변

0

시스템은 셀에 layoutSubviews 메시지를 보내드립니다. 이 메서드를 재정 의하여 셀의 현재 크기에 따라 UI 컨트롤을 배치합니다.

관련 문제