Skip to content

pageView adding 2x multiple images as the reusable recreates in UITableView #1

@asn111

Description

@asn111

Hi, Thankyou for this library and as i know you haven't updated it for 2 years, but i am stuck at a thing where i added a CaroselView and appended image view in a tableView it works fine on first viewDidLoad , but as I scroll down and bring up, if the images in pageController were 4 before , they become 8 and this goes on, i dun know now how to handle this thing, any help would be appreciated.. as shown in image.
this is what I am doing in code.

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
                 
            let cell: FeedsCollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: "FeedsCollectionViewCell", for: indexPath) as! FeedsCollectionViewCell
if postObject.contents.count > 0 {
                                for content in postObject.contents {
                cell.feedImageHeightConstaint.constant = 200
                cell.carouselViewHightContaint.constant = 200
                let postContent: PostContent = postObject.contents[0]                
                    let imageSlide = UIImageView()
                    let tap = UITapGestureRecognizer(target: self, action: #selector(showImage(_:)))
                    imageSlide.isUserInteractionEnabled = true
                    imageSlide.addGestureRecognizer(tap)
                    imageSlide.contentMode = UIView.ContentMode.scaleAspectFill
                    imageSlide.clipsToBounds = true
                    imageSlide.sd_setImage(with: URL(string: content.contentURL!), placeholderImage: nil) { [weak self](image, error, imageCacheType, url) in
                        guard let self = self else { return }
                        self.popUpFeedImage = image

                    }
                    cell.carouselView.appendContent(view: imageSlide) }
}

IMG_C8E0457DB3AB-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions