2016-05-26 6 views
-1

私は2つのカスタムセルを持っています:画像用に1、テキスト用に2(表示するラベルを使用)。 text-cellをテキストのサイズに応じて動的な高さにします。 ラベルの行を0に設定し、上、左、右の制約を使用します。ただし、配列に情報を追加するときは、リロードしてください。また、のviewDidLoadで次の符号化 :Dynamic TableViewCell |スウィフト

articleTableView.estimatedRowHeight = 150 
    articleTableView.rowHeight = UITableViewAutomaticDimension 

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ 

    if content[indexPath.row].rangeOfString("imageBase64") == nil { 

     let cell = self.articleTableView.dequeueReusableCellWithIdentifier("Text Cell", forIndexPath: indexPath) as! TextTableViewCell 

     cell.textArticle.text = content[indexPath.row] as String 

    } 
    else{ 

     let cell = self.articleTableView.dequeueReusableCellWithIdentifier("Image Cell", forIndexPath: indexPath) as! ImageTableViewCell 

     cell.imageArticle.image = decodedImage 

    } 

    return UITableViewCell() 

} 

enter image description here

ここでの問題は何ですか?

+0

ありません下制約する必要がありますか? – Wain

+0

does not help @Wain –

+1

コードを書く必要があります。それ以外の場合は、宝くじ –

答えて

0

あなたはreturn cellないreturn UITableViewCell()

関連する問題