prepareforreuse

how to redraw non-visible UICollectionViewCell's after rotation ready for when reuse occurs?

北城余情 提交于 2020-01-03 13:45:07
问题 How to redraw non-visible UICollectionViewCell's ready for when reuse occurs??? One approach I thought of was per the code in the Layout Cell prepareForReuse function, however whilst it works it non-optimal as it causes more re-drawing then required. Background: Need to trigger drawRect for cells after an orientation change that are not current visible, but pop up to be used and haven't been redraw, so so far I can only see that prepareForReuse would be appropriate. Issue is I'm re-drawing

Reusing cells in UITableView

我们两清 提交于 2019-12-02 08:27:18
问题 I have my custom cell 'NewsCell'. It contains my custom view 'ImageMosaicView' (that is just subclass of UIView). I use it to show photos like in post in Facebook. I just pass images' urls to ImageMosaicView's instance, and it loads it and shows. I have an issue. When I scroll my tableView fast, then images from previous cell appear in new cell for a moment, while new images are loading. But I have no idea how they appear there, because I provided default images. Here is an example How can I

What is the correct way to use prepareForReuse?

我的未来我决定 提交于 2019-11-27 01:42:02
问题 Need help with understanding how to use prepareForReuse() in UIKit. The documentation says you should only reset attributes of the cell that are not related to content, for example, alpha, editing, and selection state but what about resetting individual property attributes such as isHidden? Assuming my cell has 2 labels where should I reset: label.text label.numberOfLines label.isHidden My tableView(_:cellForRowAt:) delegate has conditional logic to hide/show labels per cell. 回答1: Quoting