2016-05-28 5 views
0

を使用してcellForRowAtIndexPathの下でそれを使用して私のコードでダウンロード。スクロール後にのみサイズが変更されます。私は何をすべきか? 私はautolayoutを使用しているので、私はheightForRowAtIndexPathを実装していません。私はすでにUITableViewAutomaticDimensionestimatedRowHeightを述べました。テーブルビューセルは、私がautolayout.Thisを使用していSDWebImage(組織図のオートレイアウト)

+0

待機を固定レイアウトの全景を行いますので、あなたはuitableviewautomaticdimensionを使用したりしていませんか?あなたがどこに言及したのか分かりません。 – user3353890

+0

@ user3353890私はすでにそれがビューにロードされたことを言及しました。問題は、ブロック内の制約を更新しようとするときにのみ発生します。 –

答えて

0

私はあなたがself.view.setNeedsLayoutを(呼び出すために持っていると思う)これは、制約

cell.chatImage.sd_setImageWithURL(NSURL(string: newsFeed.postImage!), placeholderImage: UIImage(named: "default_profile"), completed: { (image, error, cacheType, imageURL) -> Void in 

       let height = ((image?.size.height)!/(image?.size.width)!) * (tableView.bounds.width - 16) 
       cell.chatImageHeight.constant = height 

       self.view.setNeedsLayout() 
       self.view.layoutIfNeeded() 

      }) 
+0

いいえ、どちらも動作しません。 –

+0

mmm、estimatedRowHeightを増やすことができます またはこれを試してください。 ---------------------------------- ---------- cell.chatImageHeight.constant = height UIView.animateWithDuration(0.3、animations:cell.contentView.layoutIfNeeded)tableView?.beginUpdates() tableView?.endUpdates() –

+0

私はtableview.beginUpdatesとendUpdatesを試しましたが、これは正しい方法ではなく、indexPathの行のセルで繰り返し呼び出されているため、アプリケーションは最終的にクラッシュします。 –

関連する問題