It is because of cell reuse, so basically the cell that you scroll goes off screen and will be reused when another cell down is needed.
In your UITableViewCell
subclass you can implement prepareForReuse
method, this is called when cell is ready to be reused and you can set contentOffset to 0 there, something like:
override func prepareForReuse() {
super.prepareForReuse()
scrollView.contentOffset = CGPoint(x: 0, y: 0)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.