uicollectionview

Detecting closest collectionviewcell to the center of the collectionview

最后都变了- 提交于 2020-12-29 06:18:29
问题 Suspect I am doing something fundamentally wrong below... I have a horizontal collectionview and after dragging I want to snap the closest cell to the center. But my results are unpredictable... what am I doing wrong here? func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) { // Find collectionview cell nearest to the center of collectionView // Arbitrarily start with the last cell (as a default) var closestCell : UICollectionViewCell = collectionView

Collection View Compositional Layout with estimated height not working

牧云@^-^@ 提交于 2020-12-28 07:41:49
问题 I want my app to be optimized for every accessibility options including the text size. I made a collectionView layout based on sections with a compositional layout. So I need my cell's height to grow with it's content. I thought using .estimated(constant) would do the job but it doesn't seem to work. The inner constraints seems good to me. Here is the layout I'm working with : let size = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.42), heightDimension: .estimated(90)) let item =

Collection View Compositional Layout with estimated height not working

旧时模样 提交于 2020-12-28 07:38:18
问题 I want my app to be optimized for every accessibility options including the text size. I made a collectionView layout based on sections with a compositional layout. So I need my cell's height to grow with it's content. I thought using .estimated(constant) would do the job but it doesn't seem to work. The inner constraints seems good to me. Here is the layout I'm working with : let size = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.42), heightDimension: .estimated(90)) let item =

Multiple Section in UICollectionView

冷暖自知 提交于 2020-12-25 05:23:50
问题 I was building an iOS app for my hospital using collection view. However, I need to use multiple sections for the specialist clinic depends on the purpose. I already completed the code if it's just for 1 section. when I try to make it 2 sections, it always returns a nil value. please check my code below public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier:

Multiple Section in UICollectionView

假如想象 提交于 2020-12-25 05:21:34
问题 I was building an iOS app for my hospital using collection view. However, I need to use multiple sections for the specialist clinic depends on the purpose. I already completed the code if it's just for 1 section. when I try to make it 2 sections, it always returns a nil value. please check my code below public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier:

Auto-sizing UITableViewCell which contains UICollectionView

南楼画角 提交于 2020-12-12 11:31:33
问题 I am having troubles with an autosizing UITableViewCell which contains a UICollectionView. The view hierarchy is roughly like this UITableViewCell -- Content View ---- Custom View ------ UIStackView (vertical) --------- UILabel --------- UICollectionView (vertical flow layout) When the UITableViewCell is created or reused, the collectionView receives a datasource which it then starts to process. I need all cells of the collectionView to show in the tableViewCell, so I observe changes to the

Auto-sizing UITableViewCell which contains UICollectionView

风流意气都作罢 提交于 2020-12-12 11:31:10
问题 I am having troubles with an autosizing UITableViewCell which contains a UICollectionView. The view hierarchy is roughly like this UITableViewCell -- Content View ---- Custom View ------ UIStackView (vertical) --------- UILabel --------- UICollectionView (vertical flow layout) When the UITableViewCell is created or reused, the collectionView receives a datasource which it then starts to process. I need all cells of the collectionView to show in the tableViewCell, so I observe changes to the