uicollectionview

How to hide scroll bar of UICollectionView

馋奶兔 提交于 2020-07-14 20:30:20
问题 I m working on a UICollectionView class, and it will display the scroll bar when I scroll on the list, it's possible to hide scroll bar when scrolling? 回答1: Objective C: [collectionView setShowsHorizontalScrollIndicator:NO]; [collectionView setShowsVerticalScrollIndicator:NO]; Swift 3.0 colView.showsHorizontalScrollIndicator = false colView.showsVerticalScrollIndicator = false From storyboard: 回答2: in Swift: collectionView.showsHorizontalScrollIndicator = false in Interface Builder: 来源: https

iOS UICollectionView Horizontal Scrolling Rectangular Layout with different size of items?

别说谁变了你拦得住时间么 提交于 2020-07-09 11:57:46
问题 iOS UICollectionView how to Create Horizontal Scrolling rectangular layout with different size of items inside. I want to create a Rectangular layout using UICollectionView like below. how can i achieve? When i scroll horizontally using CollectionView 1,2,3,4,5,6 grid will scroll together to bring 7. The Below are the dimensions of 320*480 iPhone Resolution. Updated Screen below. First 6 items have below dimensions for iPhone 5s. Item 1 Size is - (213*148) Item 2 Size is - (106*75) Item 3

UICollectionView doesn't scroll inside UITableViewCell

北城余情 提交于 2020-06-29 06:19:51
问题 I'm having an issue with UICollectionView scrolling inside UITableViewCell. Unfortunately, the CollectionView doesn't scroll at all. When I'm trying to disable other UITableViewCells it works without any problem and vice versa. CollectionViewCell: import UIKit class CategoriesCollectionViewCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) backgroundColor = .white layoutUI() } required init(coder adecoder: NSCoder) { fatalError("init(codeer:) has not been

Self Sizing CollectionView inside a Self Sizing TableViewCell

心不动则不痛 提交于 2020-06-29 04:44:16
问题 I have spent weeks trying to get this to work and have looked at many different suggestions on here, Apple developer forums, Google etc. and am still pulling my hair out. Any help would be greatly appreciated. I have a ViewController that contains a TableView. It is not a full-screen tableView. The tableView is built with customTableViewCells that each holds a CollectionView. The problem I have is that the self-sizing collectionView and the self-sizing tableView rows just don't seem to work.

CollectionView header content under status bar

六眼飞鱼酱① 提交于 2020-06-24 14:05:33
问题 Here's a collection view constrained to top, left, right, and bottom of the superview with safe area layout guide enabled: I want my collection view header to be shown under the status bar. I've achieved this for iPhone 4 - 8+ screen dimensions by unchecking Safe Area Layout Guide in the size inspector for the controller's main view , and adding the following code: collectionView.contentInset = UIEdgeInsets(top: -20, left: 0, bottom: 0, right: 0) This looks great for non iPhone X view sizes:

didSelectItemAt not being called

◇◆丶佛笑我妖孽 提交于 2020-06-24 07:11:10
问题 I have my collection view ready to go and I'm trying to do didSelectItemAt to segue to the detail view. But I just want to test out logging each of the items and it's not logging. I set all the delegates already: * class ViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UISearchBarDelegate {* @IBOutlet weak var activityIndicatorView: UIActivityIndicatorView! @IBOutlet weak var searchBar: UISearchBar! @IBOutlet weak var

Grid layout with CollectionView in Swift

北城以北 提交于 2020-06-24 00:44:47
问题 I would like to achieve this result: Searching around I found out that probably the way to do it is using UICollectionView , so no problem with that since there are many tutorials and questions on Stack Overflow. I have 3 questions: I cannot find anything about the "separators" (the line that divides all the boxes). I like that it doesn't touch the screen borders horizontally. Is it done programmatically? To divide the space equally in all devices (3 boxes/buttons horizontally) I found this

UICollectionViewCell not forcing Cell Size

久未见 提交于 2020-06-23 15:35:11
问题 I am using func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return CGSize(width: 400, height: 600) } to specify my CollectionView 's cell sizes. It works fine but as soon as I add a width constraint (UILabel.width == ContentView.width) to my UILabel inside the ContentView of the cell, the cell's width shrinks to the intrinsic width of the UILabel . I am using

How do I change the horizontal spacing between cells in a horizontal scroll collection view

戏子无情 提交于 2020-06-01 07:37:06
问题 I have a collection view which is basically a horizontal table view. It's one line of cells that scrolls left and right. Sort of like a carousel without the fancy animation. I would like to be able to control the distance between cells. There is a property for doing that in the interface builde. It is in the collection view flow layout, in the inspector (in the tab with the little ruler where you usually see constraints). It is called Min. Spacing and has two variants: For Cells and For Lines

Get frame of Drag preview

南楼画角 提交于 2020-05-28 14:53:19
问题 I'm implementing drag-n-drop on UICollectionView using a new Apple's API introduced in iOS 11. What I need is to get a frame of drag preview (see below, red rectangle) I tried to get drag's location: extension ViewController: UICollectionViewDropDelegate { func collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal { let location = session.location(in: