[ad_1]
I used to be making a demo app for instagram and applied story view on the prime of House Display and determined to maintain add story button in a single part and tales coming from server in different part. Nonetheless typically the add story button exhibits picture coming from the server whereas in my code I clearly set its picture = add story picture. Here is my code:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "StoryCollectionViewCell", for: indexPath) as! StoryCollectionViewCell
if indexPath.part == 0 {
//code to set profile image
cell.ivProfilePic.picture = nil
cell.ivProfilePic.layer.borderWidth = 0
cell.ivRoundImage.isHidden = true // exterior circle if unwatched story
cell.ivProfilePic.picture = UIImage(named: "Create-Story-icon")
}
else {
let knowledge = tales[indexPath.item]
//code to set profile image
cell.ivProfilePic.picture = nil
cell.ivProfilePic.kf.setImage(with: knowledge.emblem, choices: [.processor(DownsamplingImageProcessor(size: cell.ivProfilePic.frame.size))])
}
}
I even tried to set nil so in case cell was retaining picture after scrolling it will be set nil first, nonetheless no luck. The “create story icon” will get changed by some picture coming from server typically.
Or is there every other higher solution to present tales? and implement add story button completely different means?
[ad_2]
