The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [uicollectionview]

The UICollectionView class manages an ordered collection of data items and presents them using customizable layouts. Collection views provide the same general function as table views except that a collection view is able to support more than just single-column layouts. Collection views support customizable layouts that can be used to implement multi-column grids, tiled layouts, circular layouts, and many more. Available in iOS 6.0 and later

0
votes
0answers
21 views

Calling invalidateLayout() or reloadData() to reload a UICollectionView created from storyboard after device rotation

Within a UITableViewController, UITableViewCell, I've a grid with fixed number of static UICollectionViewCells (without spacing) per row. extension NounsTVC: UICollectionViewDataSource { func ...
-3
votes
0answers
33 views

Switch between list view UITableView and grid view UICollectionView using UITableViewController

How can I achieve what Instagram did, to have both grid view (first tab or third) and list view (the middle tab)? After some research I found the following possible solutions: Use a UIViewController ...
-2
votes
0answers
23 views

How can I delete or remove an item in an array without knowing its indexPath Swift [duplicate]

How can I remove a specific item inside collectionViewCell using the button that's inside that cell. The array is originally empty. let index = collectionView. // what should I add here? ...
0
votes
3answers
37 views

UICollectionView inside UITableViewCell returning empty always even though shows as selected

I am using a UICollectionView inside UITableViewCell. I am able to select the cells inside the UICollectionView. But when i try to get the UICollectionView or selected cells, the result is always null....
0
votes
1answer
43 views

How to compare elements in an array with indexPath.item?

item added to the array when I am using didSelectItemAt indexPath and the array contains more than one element, but only one cell has the picture "Rectangle Filled" override func collectionView(_ ...
0
votes
0answers
8 views

Is there a quicker way to detect UIScrollView's contentOffset/how does UIPickerView trigger feedback even at high velocities?

I have a horizontally-scrolling UICollectionView to mimic iOS's UIPickerView. Now, I want to trigger haptic feedback when selection changes just like UIPickerView does. The problem is that when you ...
0
votes
0answers
17 views

How to use a strechyHeader and a stickyHeader in the same CollectionView?

In my collectionView I want the first Header to be strechy and all other Headers should be sticky. Is there a way to do this? Here is the Code for the strechy header class HeaderLayout: ...
1
vote
1answer
34 views

How can i show Images from Sqlite to a uicollectionview

I have some images in sqlite database. I saved Image in BLOB type (I converted in img.pngdata as NSData and save it to db). Now I want to retrieve images and show them in a uicollectionview view. when ...
1
vote
2answers
21 views

UIScrollView Delegate as a protocol default implementation

I am trying to implement default implementation for UIScrollViewDelegate method: func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: ...
1
vote
1answer
21 views

Swift -Property inside collectionView cell isn't updating after collectionView.performBatchUpdates > reloadItems(at:) runs

I have a collectionView cell that has an isExpanded: Bool property. When the cell first loads it is set to false and it only shows 1 line of text. If the text is several lines long I append "more ..." ...
0
votes
2answers
36 views

Detect tap on UIViewCollectionCell inside UITableViewCell

I want to detect a tap on imageview in uicollectionviewcell inside uitableviewcell I'm using an api response to build a data in my tableview I have this API response: {"status":1,"data":{"blocks":[{...
1
vote
1answer
52 views

How to customize UICollectionView Cell items behavior?

I'm learning swift and iOS dev! I decided to build a little app, with UICollectionView. So my question is how do I customize the behavior of UICollectionView Cell. Here is what I'm trying to ...
0
votes
1answer
18 views

Crash due to unrecognised selector on MKPointAnnotation

I have done clustering for the MKMapView. class BaseMKPointAnnotation: MKPointAnnotation { var index: Int! } class ClusteredAnnotationView: MKMarkerAnnotationView { override init(annotation:...
0
votes
1answer
31 views

Identifying and fixing auto layout issue from log output

I'm preparing a multi device information focused iOS app almost exclusively in interface builder storyboard. I'm using table view controllers with text or other content into static table view cells. ...
1
vote
3answers
76 views

Display popup below selected UICollectionViewCell

I'm working to display popup which should be display below to selected cell. I have two view controller, both contains UICollectionView. So when I select cell from first view controller I want to ...
0
votes
1answer
76 views

Custom UICollectionViewCell takes up lots of memory

I noticed that my collectionview was taking up to 50 MB of memory per cell (obviously a problem) and after some testing, it seems to be that it is my custom UICollectionViewCell itself. The cell is ...
0
votes
0answers
28 views

how can I use setEditing method in UICollectionView?

How can I set collectionView into editable view? how can I change .edit to .done system icons in Navigation bar when selecting and deleting cells in collectionView. navigationItem.rightBarButtonItem =...
0
votes
1answer
30 views

Change cell colour when tapped UICollectionView

I'm working on an app with a UICollectionView, and I use didSelectItemAt to change a boolean's value, but I need to make the cell colour change when I tap on it. This is the didSelectItemAt that I am ...
0
votes
2answers
30 views

Correct timing and place for reloading UICollectionView after picking image with UIImagePicker

I have some trouble understanding where I should reload the data inside my UICollectionView, so that the images picked through UIImagePicker from gallery get displayed on the Collection View. This is ...
2
votes
1answer
33 views

Gradient Layer of CollectionViewCell's subview exists only on first admission of View COntroller

I have a CollectionViewViewController which is pushed from another one. This CollectionViewViewController's view has two subviews: simple UIView with label inside and UICollectionView. When it's ...
0
votes
0answers
38 views

Does reloadItems(at:) reloads constraints and other collectionView items

I would like to as you about function reloadItems(at:) and generally about reloading constraints in cell. In my case I would like to update my last cell in UICollectionView. When updating this cell I ...
0
votes
0answers
15 views

How to resize CollectionView or TableView Cell from custom Cell class?

Using Swift-5.0, Xcode-10.2, iOS-12.2, I would like to dynamically change the size of one single tableView (or collectionView) cell by a user-interaction caused from within the cell (i.e. target-...
-1
votes
3answers
47 views

Get Visible Cell Index Path in CollectionView

I am having a vertical UICollectionView I am having two indicators in the top and bottom of UICollectionView. I am having 15 cells. But only 10 is visible in the current time. If cell 0 is not visible ...
-1
votes
1answer
21 views

Load data from firebase to tableview inside a collection cell

I have a collection view where you scroll vertically. Inside each collection view cell I have a tableview which consists of comments. I load data from Firebase to both the collection view and ...
-1
votes
2answers
44 views

How to remove extra space in UICollectionView when scrolling to top with Status bar gesture?

I have a CollectionView the behavior is normal when I'm scrolling down and If I want to reach to top items using the scroll top top gesture from the status bar I get an extra space. Extra space in ...
0
votes
1answer
24 views

Over lapping shadows on collection view cells

I'm trying to add a shadow to each collection view cell within a section controller with IGListKit, but the shadows overlap on to other cells causing a line to appear at the top/bottom. Any help would ...
0
votes
0answers
33 views

Expandable UICollectionViewCell - works only after scrolling

Using Swift-5.0, Xcode-10.2, iOS-12.2, Short question comes upfront - if you want to dig into the issue, you can read the long below desription (..I tried to document as thorow as possible for this ...
0
votes
5answers
70 views

How to correctly delete a cell from UICollectionView?

I am trying to delete a cell form UICollectionView but I am having an error for "Invalid Updates" 'Invalid update: invalid number of items in section 0. The number of items contained in an ...
1
vote
2answers
39 views

Deselecting the cell in cellForItemAt when selecting cell in didSelectItemAt

I have a variabel selectedIndexPath, which gets the indexPath selected from previous view controller. I am getting the required backgroundColor for cell in the collection view of present view ...
0
votes
1answer
32 views

Collection view as only part of the whole view

So I am trying to make it so that only about half of the screen is a collection view but the problem is I don't know how. I know how to do it for a whole view but not just half of one. The top half of ...
1
vote
0answers
36 views

Swift using estimatedItemSize for cell breaks cell width during scrolling

ios version 11/12 Trying to make dynamic cell height for UIViewController (cell contains image with fixed height and label that can be multiline because of that label view-cell should be able ...
0
votes
2answers
29 views

Make UICollectionViewCell's height match its content (sum height of all sub views) with AutoLayout

I found the next answer to make UIView's height match its content https://megam.info/a/39527226/7767664 I tested it, it works fine (if UIView height size in storyboard bigger or smaller than ...
1
vote
0answers
23 views

Configure a dynamic height for UICollectionView within UIStackView that is nested within a UITableViewCell

I have a UITableView with different cells, within one of these cells is a UIStackView which contains multiple UIView's, the last one being a custom class that subclasses UICollectionView. So the ...
0
votes
1answer
32 views

Swift Firebase -How to add an observer to viewDidLoad, remove it in viewDidDisappear, then read it again in viewWillAppear?

I have a chat log and I initially had my .observe( .childAdded) listener called in viewDidLoad and removed it in viewDidDisappear but after reading this comment from this question I moved the ...
0
votes
1answer
75 views

Populating tableviews with data in collection view

I need to populate data in a lot of tableviews that are in a collection view. The amount of tableviews is growing with the data coming in, which is unknown. Every tableview is in uicollectionview cell....
0
votes
1answer
27 views

Autosizing Cells in UICollectionView (all in code)

Using Swift-5.0, Xcode-10.2, iOS-12.2, There is an issue in my code while trying to achieve "autosizing" of cells in a UICollectionView (using UICollectionViewFlowLayout as its layout). The height ...
-3
votes
1answer
38 views

Modifying button header from collectionview cell

I am writing and order app for iOS,In the title I was not very explanatory, but the pictures let me tell you what I want to do. In the first picture I have a "status" button in a collectionview ...
0
votes
0answers
22 views

Like Button Pressed jumps UICollectionView to top

I have a UICollectionView which consists of a UIImageView, TextView, 2 Buttons(Like Button & report Button). The data in the collectionView is queried from Firebase Realtime database. When the ...
2
votes
2answers
49 views

Swift - Push to ViewController from UIButton in CollectionViewCell

I am trying to make my button, when tapped, to push to a new View Controller. I've tried many different ways but it won't trigger the function that I have it linked to. I also checked the 3D stack ...
1
vote
0answers
28 views

Cells Don't Resize On Custom CollectionView Flow Layout, Should Have Different Size Each

I am following an old tutorial about how to make a tag flow system on collection view. I have managed to display the full labels with different sizes each, but I am struggling to make the cells resize ...
0
votes
1answer
31 views

AddTarget on UIButton not firing

I have a UICollectionViewDataSource defined as follows. class MyDataSource : NSObject, UICollectionViewDataSource { var tables : [Table]? ... func collectionView(_ collectionView: ...
-1
votes
1answer
16 views

How to solve CollectionView contentOffSet problem with Horizontal scroll and vertical scroll?

I have this a storyboard structure: CollectionView (Vertical Scroll)> CollectionViewCell> Label + CollectionView (Horizontal Scroll) > CollectionViewCell That is, I have the first CollectionView (...
0
votes
2answers
20 views

Margins around cell like in Android GridLayout

In Android it's easy to create a grid list with the next margins: I found this solution for iOS but it doesn't add margins between cell and parent view, only between cells let itemSpacing: CGFloat = ...
0
votes
1answer
28 views

CollectionView within a CollectionView: Using didSelectItemAt to performSegue

I have a collectionView within a collectionView and I want to be able to select a cell in the 2nd collectionView to perform a segue to another ViewController. Currently, when I select a cell, I get ...
-1
votes
0answers
7 views

Dynamic UICollectionReusableView

I have UICollectionView(Multiple selection is allowed) inside UICollectionReusableView. When I select any cell of UICollectionView it changes backgroundColor = .blue and this selection is handled by ...
0
votes
1answer
29 views

Cell is in the center of collection view when there is only one cell

I want to layout cells from left to right.So I use UICollectionViewFlowLayout: UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; // use this for let cell width fit for ...
0
votes
1answer
31 views

Weird behaviour setting tableView row height and scrollPosition Swift

In the same viewController I have a calendarTableViewthat represent the month's days. At cellForRowAti select the row corresponding to current day and call a function to populate ...
1
vote
2answers
46 views

Remove spacing in CollectionView iOS

I am using UICollectionViewDelegateFlowLayout delegate to make it square but strange spacing is showing at the end. My Code func collectionView(_ collectionView: UICollectionView, layout ...
0
votes
0answers
32 views

iOS: display horizontal list whose elements vary in width

I have seen in several apps that they have a scrollable horizontal list of items and each one has a different width. How can that be achieved? It seems like I could use a collection view but that ...
0
votes
2answers
32 views

How to split sections in UICollectionView?

I have a UICollectionView which implements pages organized into sections. I want to split a section into two parts and have the following logic. But UICollectionView doesn't seem to be happy with this:...