Questions tagged [uicollectionviewcell]

UICollectionViewCell is a class from UIKit framework in iOS. A UICollectionViewCell object presents the content for a single data item when that item is within the collection view’s visible bounds. Available in iOS 6.0 and later which is inherited from `NSObject->UIResponder->UIView->UICollectionReusableView->UICollectionViewCell`

Cells present the main content of a collection view. The job of a cell is to present the content for a single item from the data source object. Each cell must be an instance of the UICollectionViewCell class, which you may subclass as needed to present your content. Cell objects provide inherent support for managing their own selection and highlight state, although some custom code must be written to actually apply a highlight to a cell. A UICollectionViewCell object is a specific type of reusable view that might be used for main data items.

To configure the appearance of your cell, add the views needed to present the data item’s content as subviews to the view in the contentView property.

Resource

Questions

4470 questions
22
votes
5 answers

Specify row and column number for UICollectionView

I want to show a UICollectionView which contains exactly 2 rows and 100 cells in each row. // 1 - (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section { return 100; } // 2 -…
onivi
  • 1,348
  • 3
  • 17
  • 25
22
votes
4 answers

UICollectionViewCell with UIScrollView cancels didSelectItemAtIndexPath

I have a UICollectionView that horizontally scrolls to show one UICollectionViewCell at a time. Each UICollectionViewCell the has a vertically scrolling UIScrollView as subview for scrolling the contents of the cell. It is only 90 % or so of the…
Zappel
  • 1,612
  • 1
  • 22
  • 37
21
votes
6 answers

UICollectionView how to deselect all

I have a FollowVC and FollowCell Setup with collection View. I can display all the datas correctly into my uIcollection view cell using the following code with no problem. func collectionView(collectionView: UICollectionView,…
user172902
  • 3,541
  • 9
  • 32
  • 75
21
votes
2 answers

Delete cell from UICollectionView without reloading from top

I am using a CollectionView in my ios app. Each collection cell contains a delete button. By clicking the button the cell should be deleted. After deletion, that space will be filled with below cell (I don't wish to reload the CollectionView and…
21
votes
13 answers

how to access from UICollectionViewCell the indexPath of the Cell in UICollectionView

i want to animate the UICollectionViewCell when action is called. i have done UICollectionViewCell in Interface Builder, the UICollectionView also. Now i want to get the correct indexPath at my actionBtnAddToCard method. thats the way i try it now…
brush51
  • 5,691
  • 6
  • 39
  • 73
20
votes
1 answer

UIStackView inside UICollectionViewCell autolayout issues after running on Xcode 10 beta

My stack view contains an image and label to display some tasks. They were all left aligned on multiple rows. I didn't have any issue running on Xcode 9, but when I run on Xcode 10 beta 6, I get some autolayout issues, I always get errors like for…
Adrian
  • 19,440
  • 34
  • 112
  • 219
20
votes
3 answers

How to determine when a custom UICollectionViewCell is 100% on the screen

From the diagram above I have UICollectionView with 4 custom cells. At any time 2 or three cells can be on the screen. How can I tell when "cell 1" or "cell 2" is 100% on the screen? Both…
Paul S.
  • 1,342
  • 4
  • 22
  • 43
20
votes
2 answers

reloading visible uicollectionviewcell when nested in uitableviewcell

I have a UICollection that shows a padlock on cells that locked to users who aren't logged in. The user can view the collection and then login in a modal. When the modal dismisses, I am trying to reload the cells of the table and the nested…
Edward Ford
  • 1,631
  • 3
  • 13
  • 25
20
votes
8 answers

UICollectionView - Scrolling to first cell

I'm making use of UICollectionView and I need to scroll to first cell after click in a button. The button is located in a (big) header section in my collection view... when clicking int it, I need scroll to my first cell located bellow of this…
20
votes
4 answers

negative or zero sizes are not supported in the flow layout

I got a rather complicated collectionView cell and I've noticed that if I scroll really fast on my collectionView it crashes the app. One of the error I got is this: negative or zero sizes are not supported in the flow layout I noticed if I just…
Zhang
  • 11,549
  • 7
  • 57
  • 87
19
votes
5 answers

How do I set collection view's cell size via the auto layout

Hi I'm trying to resize the cell via the auto layout. I want display the cell by the 3 by 3. First Cell's margin left=0 Last Cell's margin right=0 And all of the cell's space has 1pt. Like an instagram. Should I set to Cell's Size? I want set…
Shawn Baek
  • 1,928
  • 3
  • 20
  • 34
19
votes
3 answers

UICollectionView do not reuse cells

I am having trouble with reuse cells and UICollectionView on iOS 7. My code works fine on iOS 6 but in iOS 7 it does not reuse the cell after calling dequeueReusableCellWithReuseIdentifier (do not call prepareForReuse). Even this code…
19
votes
5 answers

UICollectionViewCell with rounded corners AND drop shadow not working

I want my UICollectionViewCells to have rounded corners and drop shadows but I have run into a problem where it seems I can only have one or the other, but not both. To just round the corners I use this code in the initialization of the…
jj0b
  • 1,106
  • 1
  • 12
  • 19
18
votes
2 answers

align single UICollectionViewCell to the left of the collectionView

I've got a collectionView that is inside a tableView cell. The collectionView has multiple sections. If a section has only one cell, the cell appears centered. How can I align that single cell to the left? The collectionView has the following…
18
votes
5 answers

Can´t add items to UICollectionView inside UIView xib

Objective I wanna place my (BusinessViewTableHeader: UIView) as tableView header: tableView.tableHeaderView = BusinessViewTableHeader.instanceFromNib() as! BusinessViewTableHeader Inside BusinessViewTableHeader there is a UICollectionView which are…
0xRLA
  • 3,279
  • 4
  • 30
  • 42