2013-02-20 82 views
1

單元格不按縮放級別縮進。縮進在UITableView中不起作用(ios6)

我在cellForRowAtIndexPath中配置了縮進寬度。

- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{ 

      NSInteger theLevel=0; 
      if (indexPath.row==1) { 
       theLevel=5; 
      } 
      return theLevel; 
     } 

在下圖中,我根據它的等級改變了按鈕和標籤的框架。

enter image description here

+1

你的問題說有圖像,但你還沒有添加它。請加。 – 2013-02-20 03:26:23

+0

您使用自定義單元嗎? – 2013-02-20 03:27:36

+0

@MikeD否我沒有使用任何自定義單元格。只需向單元格添加子視圖即可。 – Saurav 2013-02-20 03:31:09

回答

0

如果您已經添加子視圖到細胞,那麼你需要設置子視圖自動尺寸口罩,以便當內容查看大小得到改變,他們重新定位。

請看這answer

+0

即使我已經刪除子視圖,然後嘗試縮進仍然不工作 – Saurav 2013-02-20 06:04:36

+0

請發佈您的代碼cellForRowAtIndexPath。 – 2013-02-20 06:27:23

+0

UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; (cell == nil)cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleBlue; //添加按鈕(展開/摺疊)並在單元格上添加標籤。 [self addSubviewsToCell:cell]; } return cell; } – Saurav 2013-02-20 11:16:11