uicollectionview

How to present a UICollectionView in SwiftUI with UIViewControllerRepresentable

喜你入骨 提交于 2020-05-15 04:19:12
问题 Firstly, I know there are options for using SwiftUI Lists etc... to get similar effects. But I need the automatic scrolling capabilities of a UICollectionView so I'd really like to just implement an "old school" version. I don't even want the compositional layout version ideally. My current code looks like this: import SwiftUI struct CollectionView: UIViewControllerRepresentable { private var isActive: Binding<Bool> private let viewController = UIViewController() private let

Weird animation when deleting item from UICollectionView while UIContextMenu is shown

╄→尐↘猪︶ㄣ 提交于 2020-05-13 05:06:10
问题 I'm using UIContextMenuInteraction to show a context menu for UICollectionView as follows: func collectiovnView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { return UIContextMenuConfiguration(identifier: nil, previewProvider: nil, actionProvider: { _ in let deleteAction = UIAction(title: "Delete", image: UIImage(systemName: "trash"), attributes: .destructive) { _ in self.deleteItem(at: indexPath) }

Weird animation when deleting item from UICollectionView while UIContextMenu is shown

僤鯓⒐⒋嵵緔 提交于 2020-05-13 05:04:54
问题 I'm using UIContextMenuInteraction to show a context menu for UICollectionView as follows: func collectiovnView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { return UIContextMenuConfiguration(identifier: nil, previewProvider: nil, actionProvider: { _ in let deleteAction = UIAction(title: "Delete", image: UIImage(systemName: "trash"), attributes: .destructive) { _ in self.deleteItem(at: indexPath) }

Weird animation when deleting item from UICollectionView while UIContextMenu is shown

我的梦境 提交于 2020-05-13 05:04:08
问题 I'm using UIContextMenuInteraction to show a context menu for UICollectionView as follows: func collectiovnView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { return UIContextMenuConfiguration(identifier: nil, previewProvider: nil, actionProvider: { _ in let deleteAction = UIAction(title: "Delete", image: UIImage(systemName: "trash"), attributes: .destructive) { _ in self.deleteItem(at: indexPath) }

Weird animation when deleting item from UICollectionView while UIContextMenu is shown

我与影子孤独终老i 提交于 2020-05-13 05:02:31
问题 I'm using UIContextMenuInteraction to show a context menu for UICollectionView as follows: func collectiovnView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { return UIContextMenuConfiguration(identifier: nil, previewProvider: nil, actionProvider: { _ in let deleteAction = UIAction(title: "Delete", image: UIImage(systemName: "trash"), attributes: .destructive) { _ in self.deleteItem(at: indexPath) }

Swift 4 - Push a ViewController from a UICollectionView Cell

本秂侑毒 提交于 2020-04-30 16:37:41
问题 I'm stuck in my project and is in need for some help. I want to push/present a UICollectionViewController from a UICollectionViewCell including my UINavigationBar . I have understand that you can not actually present a ViewController from a Cell? How do I supposed to do in this case? My problem is that my NavigationBar won´t show up. Here is my Cell: import UIKit import Firebase class UserProfileHeader: UICollectionViewCell, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

UICollectionViewLayout Not working with UIImage in Swift 5 and Xcode 11

雨燕双飞 提交于 2020-04-07 08:21:11
问题 Please check this attached code and screen short. It's work fine when I set the color of container view but when I add UIImage in cell then it's not working. I changed the imageview content mode but it's not working. class ViewController: UIViewController { @IBOutlet weak var segColumn: UISegmentedControl! @IBOutlet weak var collectionView: UICollectionView! fileprivate var items: [UIImage] = [ // My images ] override func viewDidLoad() { super.viewDidLoad() self.setup() } } extension

UICollectionViewCell is wrong width with label [duplicate]

杀马特。学长 韩版系。学妹 提交于 2020-03-22 12:43:31
问题 This question already has answers here : UICollectionViewLayout Not working with UIImage in Swift 5 and Xcode 11 (2 answers) Closed 2 days ago . I found something strange. I created a custom UICollectionViewCell and a label inside it. I applied auto-layout only to the top, leading, and bottom of the label. class TestCollectionViewCell: UICollectionViewCell { @IBOutlet weak var label: UILabel! override func awakeFromNib() { super.awakeFromNib() } } And if the text is long, it is clipped off

UICollectionView sticky header disappears for while after inserting section when collection is overscrolled (bounce effect)

柔情痞子 提交于 2020-03-22 08:01:33
问题 I'm using UICollectionReusableView as a header of UICollectionView section. I enabled "sticky headers" with: let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout layout?.sectionHeadersPinToVisibleBounds = true I'm inserting new sections to collection with: collectionView.performBatchUpdates({ self.collectionView.insertSections(IndexSet(integersIn: collectionView.numberOfSections...viewModel.numberOfSections - 1)) }, completion: nil) If the insertion happens when

[NSPlaceholderString initWithString:]: nil argument' on iOS13

穿精又带淫゛_ 提交于 2020-03-21 20:33:17
问题 Heres my situation i have a UICollectionView nested inside a UITableVIew the table view scrolls vertically and the collection view scrolls horizontally inside the table view. i have made the tableview as the delegate for the collection view here a code snippet: i know this code doesnt make sense cause i have removed a lot of stuff from it i just shared it for you guys to see how i set up the tableview and the collectionview in case its helpful class HomeViewController: UIViewController