uicollectionview

Displaying download progress in reusable cells

99封情书 提交于 2019-12-19 04:39:05
问题 I am trying to display download progress in my collectionview cells. Im currently using the parse progressblock which has an instance of the cell and updates the progress bar. }, progressBlock: { (percent) in self.mainQueue.addOperation { // set the downloadProgess var to update from cellForItemAt // downloadProgress = (Float(percent) / Float(100)) if let downloadingCell = self.collectionView.cellForItem(at: self.indexPath) as? InnerCollectionCell { downloadingCell.progressBar.isHidden =

Drag and reorder - UICollectionview with sections

梦想的初衷 提交于 2019-12-19 03:57:33
问题 Is that possible to do drag and reorder from one section to another section from collectionview - iOS 9. Every time am dragging from 1st section to drop at 4th section am getting below crash, Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering: func collectionView(collectionView: UICollectionView, moveItemAtIndexPath sourceIndexPath: NSIndexPath,toIndexPath destinationIndexPath: NSIndexPath) { let sequence = ArrayrelatedSequence

Display different amount of cells in a row within a UICollectionView

*爱你&永不变心* 提交于 2019-12-19 03:09:28
问题 I would like to have a UICollectionView that, in the first row there is a cell with all the row's width, and the second row has 3 cells. I have researched the documentation but I'm not able to do it. Something like this: Thanks in advance 回答1: Make 2 Cell prototypes in collection view in your storyboard, and set them reuse identifiers In your ViewController's .m file implement this functions - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } -

UICollectionView header position in horizontal scroll direction mode with flow layout

核能气质少年 提交于 2019-12-18 18:48:50
问题 I have ios UICollectionView with Flow layout with horizontal scroll direction. In this situation typical header position is on the left side of cells. I want to make header on the top of section cells Have you any idea how can I do this? 回答1: I think you can get what you need using standard behavior for the header. Set it up (probably in viewDidLoad): UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; flowLayout.headerReferenceSize = CGSizeMake(self

UICollectionViewCell gets hidden randomly

喜你入骨 提交于 2019-12-18 17:48:09
问题 I have a UIView in which I am adding a UICollectionView to act as a banner view to look like a carousel. The Viewcontroller in which UIView is present, is part of pageviewcontroller . PageVC --> UIViewController --> UIView --> UICollectionView . Each VC has its own banner, so when the page is swiped, I reload the collectionView with the respective data and I am able to see it. Now if visit a page which I already visited, the collectionview cell disappears. The collectionview is visible but

multiple UICollectionviews inside a UItabelview with sections - swift

拥有回忆 提交于 2019-12-18 17:04:33
问题 Basically, I am trying to obtain something similar to the result of this : http://ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell how ever, i'm want 2 collectionsViews, 1 in first section and another in 2nd section how do i achieve this ? i'm bashing my head in here... each time i try to set delegate and datasource it fails and says i need to register a nib Also i have no idea how i separate the collection views in it's cellForRowAtIndexPath, how can i see which one is

UICollectionViewCell using prototype sizes

我只是一个虾纸丫 提交于 2019-12-18 16:56:56
问题 I have an UICollectionView with three different prototype cells, each of which with different heights set via Storyboard. During runtime, the Collection View uses its own cell size, ignoring my Storyboard ones. I am currently using collectionView:layout:sizeForItemAtIndexPath: with a couple conditionals to set each CGSize straight. Is there a better way to set the cell sizes? I don't seem to be able to retrieve the Storyboard size each cell has, and CGSizeMake seems too hardcoded and not

Access a UICollectionView's parent UIViewController

点点圈 提交于 2019-12-18 15:52:55
问题 My question is fairly straightforward. I have a UIViewController containing a UICollectionView. In initialising my cells, I add a gesture recogniser to each of them so that when you tap and hold it calls a function with a selector. This function then creates a UIAlertController which I want to present. (Basically, you hold a cell, it asks you if you want to delete it and if you say yes it eliminates it from the CollectionView) The problem is that I can't present a UIAlertController from my

Trying to override “selected” in UICollectionViewCell Swift for custom selection state

China☆狼群 提交于 2019-12-18 12:47:47
问题 I am trying to implement a custom selection style for my cells in a UICollectionView. Even though it is easily possible to do this manually in the didSelect and didDeSelect methods I would like to achieve this by manipulating the "selected" variable in UICollectionViewCell. I have this code for it: override var selected: Bool { get { return super.selected } set { if newValue { self.imageView.alpha = 0.5 println("selected") } else if newValue == false { self.imageView.alpha = 1.0 println(

How do I alternate a UICollectiveViewCell's background color based on row?

穿精又带淫゛_ 提交于 2019-12-18 12:44:18
问题 I know this is fairly easy for UITableViewCells but I'm not sure how to approach this using a UICollectionView. EDIT. Pictures for clarification. Text content of the cells are not the same here but they should be. In landscape: In portrait: I tried to naively switch the color of my cell's text label with the cell's background color based on the index path's row property in the cellForItemAtIndexPath: method. However Index Path's row property isn't really a row in UICollectionViewFlowLayout.