Hello, as discussed in my previous topic with @Claude31 (Link ) I have a problem with riding off layout. Should I register the nib somewhere and in nib put constraints for a cell? Below I'm showing What I've got so far and how it looks like on device:
I have tried many solution but nothing helped, so i just putted constraints for collection view. I dont know how to put constraints for the cell (It is greyd out), maybe in nib file?:
I have defined there class and identifier.
Here is how it looks like on device:
I would like it to look like in the first screen shot (storyboard).
Here are my files connected with collectionview vc:
First one is Controller with code, another two are connected with the cell.
Here is the ModernizmCollectionViewCell file:
import UIKit
class ModernizmCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var imageCell: UIImageView!
@IBOutlet weak var navButton: UIIButton!
@IBOutlet weak var title: UILabel!
@IBOutlet weak var subTitle: UILabel!
@IBOutlet weak var locationLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
}
Many thank for your help.
It would be so much easier if you sent project by mail…
.
Ok, so I have added this in ViewController.swift:
Yes, and this could be done in IB as well.
To have the image fit into its area, set the ImageView View aspect to Aspect fit
And set constraints for the ImageView relative to its container (cell).
To create rounded corners, you will need to use layer. But that will be done later.