2015-10-07 27 views
0

我設計在我所使用的表view.This表視圖一個應用程序使用定製cell.I給組成比例高度表view.T分頁器在適合視圖的動態高度中不可見?

的tableview高度約束:

equal height to mainview 
multiplier:189:568 

細胞性質

cell height:77 

enter image description here

圖片的約束:

enter image description here

標籤約束

​​

TextViewContsraints

enter image description here

右下角標籤約束

enter image description here

代碼,以使該行的高度動態

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

    (NSIndexPath *)indexPath 
    { 
     float percentage = (77.0/568.0); 
     float height = self.view.frame.size.height * percentage; 

     return (height>77.0)?height:77.0; 
    } 

發放屏幕

enter image description here

+0

縮小圖像大小並重試。 –

+0

我已經實現縮小圖像大小 – Techiee

+0

您是否在您的自定義單元實現中調用'[super layoutSubviews]'? – Abhinav

回答

0

IB中的UITableViewCell是否與覆蓋drawRect的UITableViewCell子類關聯:?如果是這樣,請確保您正在調用超級實現,因爲這是底部繪製線的原因。如果您重寫layoutSubviews,請確保沒有視圖遮擋單元格的底部。

在我的情況下,我忘記了覆蓋layoutSubviews方法後調用[super layoutSubviews]。花了我幾個小時才發現問題。

希望這會幫助你。

0

將自定義單元大小增加到80-88可能會解決您的問題