uicollectionviewcell

UICollectionView Cell with Image, change Background with click

守給你的承諾、 提交于 2020-01-29 17:55:11
问题 I have a UICollectionView with Custom CollectionView Cells . On each Cell there is a Image on it, which is as big as the whole Cell. Now i want to highlight the Cell when the User touches the Cell. First i tried it with the following delegate Methods : - (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell* cell = [self.collectionView cellForItemAtIndexPath:indexPath]; cell.contentView.backgroundColor = [UIColor

Is it possible to retrieve data from collectionViewCell?

独自空忆成欢 提交于 2020-01-26 04:44:45
问题 I'm looking to retrieve data, such as a label.text from within a visible cell, and I don't know how that would be possible. Plain context: I have a collectionView displaying questions (each cell display a question) the collectionView is within a UIView. Within this same uiview I have a button which, when pressed, should validate the question answer. At this point the only thing Im doing is linking a @IBAction to the button in order for it to println the question from the visible cell (only

Loading UICollectionViewCell one at a time

放肆的年华 提交于 2020-01-24 01:10:10
问题 As per this article http://aplus.rs/2014/how-to-animate-in-uicollectionview-items/ I am trying to load a UICollectionViewCell one at a time to animate the cell when it appears. However, when I call the code the loops the cellCount++, it produces this error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (1) must be equal to the

UICollectionView last cell not aligned

不问归期 提交于 2020-01-23 07:54:05
问题 I am new to iOS and I now have an issue. My goal is to get a sliding bar with filtering buttons on it. I have a UICollectionView as a subview in some other view all is displaying well except for the last cell. Here is the delegate and datesource of the uicollectionview class PmtCategoryCollectionViewController: UICollectionViewController { var categories = ["Mediterranean", "Italian", "French", "Chinese", "American", "Indian"] var buttonDistanceToEachOther: CGSize = CGSize(width: 20, height:

Animate UICollectionView cell size change and reposition surrounding cells

前提是你 提交于 2020-01-22 05:46:20
问题 Goal: To animate the change of a cell's height and reposition surrounding cells. Scenario: Some cells in a collection view load remote images. Initially, those cells are sized statically and an activity indicator is shown. After an image is loaded, it is added to its cell and the cell's height is changed to fit the photo. Notes: I am animating the cell's frame change with animateWithDuration . This works fine, except an increased cell size has it overlapping the cells below. I've blindly

How to expand collectionview cell to full screen [closed]

本秂侑毒 提交于 2020-01-21 07:48:45
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . 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? 回答1: If you want to increase cell

Selector to get indexPath UICollectionView Swift 3.0

青春壹個敷衍的年華 提交于 2020-01-20 08:41:29
问题 I'm trying to get indexPath on the cell when it is tapped twice. I'm passing arguments in Selector like this but it is giving error. What is the correct format for this ? func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if let subOptioncell : SubOptionsCollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: subOptionsCVReuseIdentifier, for: indexPath) as! SubOptionsCollectionViewCell let imageNamed = "\

Selector to get indexPath UICollectionView Swift 3.0

落爺英雄遲暮 提交于 2020-01-20 08:39:55
问题 I'm trying to get indexPath on the cell when it is tapped twice. I'm passing arguments in Selector like this but it is giving error. What is the correct format for this ? func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if let subOptioncell : SubOptionsCollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: subOptionsCVReuseIdentifier, for: indexPath) as! SubOptionsCollectionViewCell let imageNamed = "\

Why aren't my videos showing in cells in my scroll view with AVPlayer

↘锁芯ラ 提交于 2020-01-16 08:27:13
问题 I know my code isn't efficient as of yet, I just want it to work really before I optimise it. Basically I have a function FeaturedPostsManager.shared.getFeaturedPosts to get videos from my server and store it in the app's cache and store the local url to the video. Which in my code I do it twice for two different videos, so I have two urls that go to two different videos. I then add them urls in my custom data array for my scroll view to unwrap for each cell and add it's respective video to

UICollectionView Tap Selects More Than One Cell

蹲街弑〆低调 提交于 2020-01-14 15:01:29
问题 I have a strange problem when tapping a single UICell in UICollectionView and then scrolling down or up in the UICollectionView I see that more one cell is selected. The other cells that are selected that were not tapped seem to be randomly selected throughout the UICollectionView layout. I have 3 columns of cells and many rows in the UICollectionView. In my code I have the following: - (void)collectionView:(UICollectionView *)myCV didSelectItemAtIndexPath:(NSIndexPath *)indexPath { LogInfo(@