i want to make Swift app with CollectionView in Xcode, i have implemented it well and now i want to show some other stuff after some Posts, and i have created Xib and swift file for it. but the problem is when i try to show label in new cell i got this error ,,
i have registered new cell in ViewDidLoad Like this:
collectionView.dataSource = self
collectionView.delegate = self
collectionView.collectionViewLayout = UICollectionViewFlowLayout()
collectionView.register(AdViewCell.self, forCellWithReuseIdentifier: "adCell")
and i have used 300X250 space in AdViewCell and when i load posts i can see the white space of 300X250 size.. look at this
but even when i try to change its background color or anything , nothing happens when app is loaded..
i have connected Label to AdViewCell also..
class AdViewCell: UICollectionViewCell {
@IBOutlet weak var namelbl: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
please help
2
Answers
Your are using "cell" and "adcell" for the same indexPath.
try this:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {