Popover
Popover copied to clipboard
Can I add a CollectionView?
I'm trying to add a collection view this way but cells are not being displayed. Cell is created through storyboard nib, all a get is constraints warnings in console.
` let collectionView : UICollectionView = { let layout = UICollectionViewFlowLayout() let cv = UICollectionView(frame: .zero, collectionViewLayout: layout)
cv.delegate = self
cv.dataSource = self
return cv
}()
let nib = UINib(nibName: "CategoriesCollectionViewCell", bundle: nil)
collectionView.register(nib, forCellWithReuseIdentifier: "CategoriesCell")
// collectionView.register(CategoriesCollectionViewCell.self, forCellWithReuseIdentifier: "CategoriesCell")
let cvFrame = CGRect(x: 0, y: 0, width: self.view.frame.width - 60, height: self.view.frame.height - 100)
collectionView.frame = cvFrame
let startPoint = CGPoint(x: self.view.frame.width - 60, y: 55)
self.popover = Popover()
popover.show(collectionView, point: startPoint)`
I'm trying to add a collection view this way but cells are not being displayed. Cell is created through storyboard nib, all a get is constraints warnings in console.
` let collectionView : UICollectionView = {
let layout = UICollectionViewFlowLayout() let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) cv.delegate = self cv.dataSource = self return cv }() let nib = UINib(nibName: "CategoriesCollectionViewCell", bundle: nil) collectionView.register(nib, forCellWithReuseIdentifier: "CategoriesCell")
// collectionView.register(CategoriesCollectionViewCell.self, forCellWithReuseIdentifier: "CategoriesCell")
let cvFrame = CGRect(x: 0, y: 0, width: self.view.frame.width - 60, height: self.view.frame.height - 100) collectionView.frame = cvFrame let startPoint = CGPoint(x: self.view.frame.width - 60, y: 55) self.popover = Popover() popover.show(collectionView, point: startPoint)`
I'm trying to add a collection view this way but cells are not being displayed. Cell is created through storyboard nib, all a get is constraints warnings in console.
` let collectionView : UICollectionView = {
let layout = UICollectionViewFlowLayout() let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) cv.delegate = self cv.dataSource = self return cv }() let nib = UINib(nibName: "CategoriesCollectionViewCell", bundle: nil) collectionView.register(nib, forCellWithReuseIdentifier: "CategoriesCell")
// collectionView.register(CategoriesCollectionViewCell.self, forCellWithReuseIdentifier: "CategoriesCell")
let cvFrame = CGRect(x: 0, y: 0, width: self.view.frame.width - 60, height: self.view.frame.height - 100) collectionView.frame = cvFrame let startPoint = CGPoint(x: self.view.frame.width - 60, y: 55) self.popover = Popover() popover.show(collectionView, point: startPoint)`