uicollectionviewcell

Collection View Cells have incorrect content size

♀尐吖头ヾ 提交于 2019-11-28 11:06:49
问题 I made a collection view with 144 cells. I have them setup for single selection. I have been playing with the settings I have for a while now, but any setup that actually displays the cells correctly has this problem where two specific cells consistently are the wrong size. Note that the problem only happens when testing on the iPad pro. They will resize often under conditions that I can't replicate when changing their image to others back and forth. I try to only call reloadData() when

UICollectionView image on cell memory warning

久未见 提交于 2019-11-28 10:37:19
问题 im using Xcode 4.6.1, iOS SDK 6.1, ARC and Storyboards, testing device iphone 4S running 6.1.3 I'm having a little trouble configuring a collectionviewcell containing pictures, there thing is when i try to add some custom pictures on the cell, the memory just jump directly by 30-40mb each picture, the picture are taking directly on the device camera and saved on documents directory, maybe you can help me with this. here are the codes i use: --the code to load the images path on an array

Add button at the end of collection view in storyboard

限于喜欢 提交于 2019-11-28 10:34:06
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? In storyboard you can enable it by selecting the radio button title "Section Footer", for your UICollectionView and then by dragging UIButton there. You can also override this function: - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:

Getting data from a textfield inside a prototype uicollectionviewcell

你说的曾经没有我的故事 提交于 2019-11-28 09:26:25
问题 I have a UICollectionViewCell which is prototype cell, I have a textfield in it, which by default present in all of them. (which is what I want). I want to be able to when the user inputs a value in these textfields to be able to retrieve the data and the cell which the data was put into(maybe the number of the row). I have seen a few other related questions but none seems to work for me. Any ideas? @interface ViewController () { NSArray *collections, *numbers; NSMutableArray

Delete cell from UICollectionView without reloading from top [closed]

我是研究僧i 提交于 2019-11-28 05:28:29
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 start from top again) How do I delete a particular cell from UICollectionView with autolayout? Anil Varghese UICollectionView will animate and automatically rearrange the cells after deletion. Delete selected items from collection view [self.collectionView performBatchUpdates:^{ NSArray *selectedItemsIndexPaths = [self.collectionView

Animate uicollectionview cells on selection

筅森魡賤 提交于 2019-11-28 05:25:51
问题 I have created a customlayout and set my cells position attribute in layoutAttributesForItemAtIndexPath like this attributes.center = CGPointMake((size.width/2 - 100) + 100, (size.height/2 - 150) +100); I would like to animate a cell when it is selected. replicating the kind of animations we get with the initialLayoutAttributesForAppearingItemAtIndexPath & finalLayoutAttributesForDisappearingItemAtIndexPath . I'd like to do this when a cell is selected and de-selected. so for instance: Cell A

Change Background of UICollectionView Cell on Tap

冷暖自知 提交于 2019-11-28 05:18:37
I have a UICollectionView that I have created programmatically. I would like for the collection view to behave in the following way: 1. User touches cell 2. Cell background color changes 3. User releases touch 4. Cell background color changes This should be a quick color change that happens just before the selector related to the tap action is executed in which the viewcontroller containing the collection view is popped off the stack. I have been looking at this question: UICollectionView cell change background while tap in which there is the following summary of methods to use for this

How to change UICollectionViewCell size programmatically in Swift?

不羁的心 提交于 2019-11-28 04:05:12
I have a UICollectionView with a segmented control to switch between data. But how do I change the UICollectionViewCell size properties programmatically ? then I can custom each style appropriately for each data type. For example change the width to 520 points and height to 100. I am new to iOS development and am experienced with CSS :/ I know how to do it in Xcode (obviously) but do not know the correct methods to change it in swift. Any ideas or feedback is much appreciated (Y) Make sure you conform to UICollectionViewDelegateFlowLayout for your class (for swift4) eg. class MyClass:

Resize UICollectionView cells after their data has been set

喜欢而已 提交于 2019-11-28 03:39:28
My UICollectionView cells contain UILabels with multiline text. I don't know the height of the cells until the text has been set on the label. -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath; This was the initial method I looked at to size the cells. However, this is called BEFORE the cells are created out of the storyboard. Is there a way to layout the collection and size the cells AFTER they have been rendered, and I know the actual size of the cell? Ignatius Tremor I think your

Adding rounded corner and drop shadow to UICollectionViewCell

无人久伴 提交于 2019-11-28 02:54:45
So I already went through various posts on adding 2nd view for adding shadow, but I still cannot get it to work if I want to add it in UICollectionViewCell . I subclassed UICollectionViewCell , and here is my code where I add various UI elements to the cell's content view and adding shadow to the layer: [self.contentView setBackgroundColor:[UIColor whiteColor]]; self.layer.masksToBounds = NO; self.layer.shadowOffset = CGSizeMake(0, 1); self.layer.shadowRadius = 1.0; self.layer.shadowColor = [UIColor blackColor].CGColor; self.layer.shadowOpacity = 0.5; [self.layer setShadowPath:[[UIBezierPath