Questions tagged [uicollectionview]

2

votes
1

answer
455

Views

Create UIImage from UICollectionView Visible Area

I have a collection view that scrolls horizontally. I need to create a UIImageView from the currently visible portion of the collection view. I usually use the following method for this: + (UIImageView *) imageCopyOfView:(UIView *)inputView { UIGraphicsBeginImageContext(inputView.bounds.size); [inp...
2

votes
1

answer
973

Views

Style view like iphone appstore app?

I want to style a view similar to iPhone Appstore app. I don't understand how the view is laid using IB or is it laid programatically. I dont know. Are they multiple collection view laid on scrollview or is it one collection view with some custom layout or table view. Also every collection view is...
Taseen
2

votes
1

answer
102

Views

How to programmatically layout days in a calendar in a way that matches the month and day of the week?

How can I do this? I'm sure this has been done before. I've checked a couple of projects on github, such as calendar master, but they are all more complicated than what I need. Oct 2013 S M T W T F S 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 1 2 3 I...
nmdias
1

votes
1

answer
242

Views

Best approach to implement this design [ios]

What would be the best approach to implementing a design like the one below? Couple of things: Level cell can fall between any 4 cells on the grid Whole board is scrollable I'm leaning toward UICollectionView but I'm not exactly sure how to do the 'level cell.' One of the approach might be to split...
SJonRails
2

votes
1

answer
2.9k

Views

How to expand collectionview cell to full screen [closed]

I created a horizontal collection view and single cell is displayed in screen. I try to preview another views in each cell and when user swipe up the cell should expand to full screen. I don't know to how to approach this problem? How can I expand cell to fullscreen animated?
TheZipper
6

votes
3

answer
7.6k

Views

Check whether cell at indexPath is visible on screen UICollectionView

I have a CollectionView which displays images to the user. I download these in the background, and when the download is complete I call the following func to update the collectionViewCell and display the image. func handlePhotoDownloadCompletion(notification : NSNotification) { let userInfo:Diction...
Alk
2

votes
2

answer
629

Views

Why Do My UICollectionViewCells Disappear After Scroll?

I am using a UICollectionView with a custom layout, but I am having issues with cells disappearing after I scroll down and back up. Please see a video demonstration of my issue. I've done some Googling around and other people have related issues and I recognise that this is possibly due to cell reus...
Loic Verrall
3

votes
2

answer
3.8k

Views

How to get the index path of a UICollectionView header?

Using the view's indexPathForItemAtPoint, I will get an index path for a cell, but never a UICollectionReusableView (header/footer) -- as it always returns nil.
akaru
2

votes
1

answer
525

Views

UICollectionView doesn't scroll after setting contentInset

I have a collection view that scrolls horizontally and spans its parent view's full width. My cheap way to achieve paging on it is to set the cell widths to be equal to 1/3 of the collection view width, and to set that same amount of width as left and right content insets. I disable scrolling in IB...
user1272965
3

votes
1

answer
469

Views

How to get the subview's size after viewWillTransitionToSize

I have a UICollectionView which is shown by a popover presentation. The UICollectionView contains 16 rows of 10 cells each, and I want the cells to fill out the width of the UICollectionView. I'm trying to adjust the size of each cell in viewWillTransitionToSize but I'm having trouble getting the ri...
Lizzan
2

votes
1

answer
195

Views

UICollectionViewCell with self-sizing vertically according to amount of text in Universal app

I am an amateur iOS developer. I have made a simple Single Window Universal app in iOS to demonstrate my problem. In interface builder, I added the UICollectionView to my view and gave it specific constraints to cover entire screen. Then I made a prototype cell and gave it width of 580 and height of...
Rohan Sanap
3

votes
1

answer
180

Views

confusion in understanding bounds property for UIView, UICollectionView, UITableView, UIScrollView

I have been seeing negative value in UICollectionView bounds 'Y' value and its keep on reducing it when scrolls down and increasing to positive value when scroll up. How does bounds values work in UICollectionView? as far as I know, bounds in UIView has constant X and Y values. Am I thinking in a...
Sai Jithendra
2

votes
3

answer
3.6k

Views

Present Modal View in iOS 6

I want to display a modal view but I have two problems: There is no presentModalViewController in iOS 6 and I have to use presentViewController which is just display my second ViewController like a modal segue not a modal window without full screen option, My second problem is how can I show the mod...
Maziyar
4

votes
3

answer
3.8k

Views

Can't get UIMenuController to show custom items

So, I am not sure if I am doing something wrong here, but I have a UIViewController that has a UICollectionView on it. In the UIViewController's viewDidLoad method, I do the following it doesn't add any custom menu items to the popup that shows up. UIMenuItem *removeItem = [[UIMenuItem alloc] initW...
Andrew Riebe
4

votes
1

answer
5.9k

Views

UICollectionView Header Compatible Views

I've constructed an UICollectionView in a storyboard and implemented all of its required data source and delegate methods in the view controller. In the storyboard, I checked the Section Header property on the collection view and set the header view's class to a subclass of UICollectionResusableView...
The Kraken
5

votes
2

answer
2.7k

Views

Swift: Expand UITableViewCell height depending on the size of the UICollectionView inside it

Hi everyone. I started learning programming 1 month ago so please be nice if I don't explain my problem well :) My project is composed of a main UITableView. In each cell of the UITableView, I have a UICollectionView (on horizontal scrolling). Img 1 : Main view The width of each UICollectionView...
Jean Baptiste
4

votes
3

answer
3.9k

Views

UICollectionView received layout attributes for a cell in ios 7

I'm using custom UICollectionView on my app. However, I have a problem that make my app crash. The log for the crash: Note: This bug doesn't occur on iOS 8 2015-05-29 11:49:26.316 app9to5[1834:607] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionVie...
Cuong Nguyen
22

votes
6

answer
13.6k

Views

UICollectionView exception in UICollectionViewLayoutAttributes from iOS7

I have done a View in CollectionView with CustomLayout. In iOS6 it worked great but iOS7 it throws an exception like this. Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'layout attributes for supplementary item at index path ( {length = 2, path = 0 - 0}) chan...
Jirune
1

votes
3

answer
4.2k

Views

How to use UICollectionViewController in storyboard while still supporting ios 5.1?

It is a best practice to detect if a certain feature's class exists and degrade user's features depending on availability. I created UICollectionView in storyboard and a standard tableview to support ios 5.1 users. I then simply check if the user has this feature and segue to the appropriate scene....
Ryan Romanchuk
6

votes
1

answer
16k

Views

UICollectionView Footer

I am trying to add footer to the UICollectionView. Following is my code, UICollectionView is added through IB IN viewDidLoad I register the footer, [mCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@'fo...
subhash Amale
2

votes
2

answer
623

Views

iOS: How to create a collectionView with different size & clickable cells

I would like to create a planning app, what I have already done, but my problem is that now, I would like to create different cells as following: I don't know if it is possible... Today, I have this code: func numberOfSections(in collectionView: UICollectionView) -> Int { //colonnes: models if _even...
ΩlostA
7

votes
1

answer
8.9k

Views

Caching an Image and UICollectionView

I'm pretty new to Objective-C so hopefully this all makes sense. I've downloaded images from a server and have displayed them in an image view in the collectionView cellForItemAtIndexPath: method. The issue I'm facing is that the images don't appear to be caching. It looks like each time a cell i...
BrianS
2

votes
1

answer
496

Views

unable to select Item in collection view

I tried to use this code for collectionView How to make a simple collection view with Swift but for swift 3 I added these changes in viewController import UIKit class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate { let reuseIdentifier = 'cell' // also enter t...
joda
3

votes
2

answer
1.8k

Views

Add button at the end of collection view in storyboard

I have a UICollectionViewController in a storyboard. I know how to add cells and modify them but for some reason I can't add any other view or UI element after my UICollectionView. Is there a way to do this in the storyboard? If not how can I do this programmatically?
aldominium
4

votes
1

answer
643

Views

UICollectionView cells recalculating sizes (flicker) while scrolling

After initial table load, everything is working correctly. But after inserting a new cell, and scrolling fast up, you can see some cells recalculating their sizes (animating). It's really odd and happens to 2-3 cells max. I'm using a bottom-up collection view with reversed cells, and custom flow lay...
HelloimDarius
2

votes
3

answer
78

Views

Unable to add footer to Collection View

All I need is a footer of height 50 with background color black. Nothing more. Forget the implementation below for some time and let me know how you would implement the same. I am using the following: func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: Str...
Enrik Qaz
2

votes
1

answer
145

Views

AFNetworking low memory issue

I download image using this code: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { SECustomCollectionViewCell *collectionViewCell = (SECustomCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@'SECu...
Matrosov Alexander
2

votes
1

answer
692

Views

UICollectionView deselectItem when cell pre-fetching is enabled

On iOS 10.0, UICollectionView pre-fetches cells by default. This leads to cells that are prepared for being shown on screen, but are hidden. This question describes it really well. The following code will successfully deselect an index path when its cell is either visible or does not exist at all. I...
Sebastian Kirsche
2

votes
1

answer
110

Views

UICollectionViewCell checkmark return nil

i tried to follow this But when i do cell.checkmarkView.checked = true it returns nil so everything crash. Here is my MyCollectionViewCell: class MyCollectionViewCell: UICollectionViewCell { @IBOutlet weak var myLabel: UILabel! var checkmarkView: SSCheckMark! override init(frame: CGRect) { super.in...
John
3

votes
2

answer
1.9k

Views

get CGPoint inside didSelectItemAtIndexPath method of CollectionView

Is there a way that I can get coordinates of clicked point inside collectionViewCell? I want to do method A if I clicked at rect with Y coordinate < 50, and method B if Y >50.
AleksandarNS
37

votes
1

answer
2.8k

Views

Custom animation when switching from one UICollectionViewLayout to another?

As a test I made one layout that displays cells in a vertical line and another that displays them in a horizontal layout. When I call [collectionView setCollectionViewLayout:layout animated:YES]; it animates between the two positions very cleanly. Now that I'd like to do is have all the views do a...
Mason Cloud
12

votes
4

answer
10.8k

Views

UICollectionViewCell register class fails, but register nib works

Creating a custom UICollectionViewCell for my UICollectionViewController, it works by registering the nib; however, fails to register by class. Using registerClass() - fails Registering by class seems correct - it builds, but throws an exception at runtime unwrapping optional elements from the UIVie...
Jason Sturges
3

votes
5

answer
2.7k

Views

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

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...
Steve Moser
2

votes
2

answer
2.1k

Views

swift collectionview cell didSelectItemAtIndexPath shows wrong cell if you scroll

Let's say you set up a bunch of image views inside a UICollectionView's cells (from an array of image names) and make their alpha 0.5 by default when you set up the items. Then you make the image view's alpha to 1.0 in the didSelectItemAtIndexPath func, so it becomes alpha 1 when the user taps. Thi...
dmcknight
22

votes
7

answer
23.4k

Views

UICollectionViewFlowLayout not invalidating right on orientation change

i have a UICollectionView with a UICollectionViewFlowLayout. I also implement the UICollectionViewDelegateFlowLayout protocol. In my datasource i have a bunch of UIViewControllers which respond to a custom protocol so i can ask for their size and some other stuff. In in the FlowLayout delegate when...
xxtesaxx
1

votes
1

answer
13.9k

Views

UICollectionView tutorial [closed]

I am just wondering is there any tutorial out their which explains creating a UICollectionView pragmatically and display as a small subView of mainView. Please Note: NO interface Builder at all
bhawesh
2

votes
1

answer
2k

Views

Reuse single UICollectionViewCell in multiple collection views

I have multiple collection views that need to use the same prototype cells. Right now, I'm duplicating the prototype cells in each collection view in storyboard (as seen below). This is not very DRY and becomes a pain when making storyboard changes to the cells. Is it possible to define the cell in...
mnort9
3

votes
1

answer
446

Views

UICollection view delete item rearrangement weird animation

I have a basic UICollectionView and a basic list of items. I've implemented a delete button on the items so that the user can remove some of them. Everything works great apart from the item rearrangement while the item is being deleted. If you delete the item N-1, it visually deletes the first one i...
vivien.destpern
7

votes
3

answer
16.2k

Views

Poor UICollectionView Scrolling Performance With UIImage

I have a UICollectionView in my app, and each cell is a UIImageView and some text labels. The problem is that when I have the UIImageViews displaying their images, the scrolling performance is terrible. It's nowhere near as smooth as the scrolling experience of a UITableView or even the same UIColle...
Nick
1

votes
2

answer
4.5k

Views

iOS how to detect swipe left or right on UICollectionView that otherwise only scrolls vertically?

My collection view is working great. It shows a grid of photos and lists hundreds of them. You can swipe vertically to scroll through them all. Life is good. However, I now have a new requirement. I need to be able to detect when the user is swiping left or right. I need to be able to intercept this...
John Erck