uicollectionviewlayout

How Can I Animate the Size of A UICollectionViewCell on Scroll so the middle one is largest?

自闭症网瘾萝莉.ら 提交于 2020-01-13 04:55:09
问题 I have a UICollectionView that shows several rows with one, full-width column (looks like a UITableView) What I'd like to achieve is something similar to this: ... where the middle cell has a much greater height. As the user scrolls up and down, the cells before and after the middle cell animate back to the default height for the given cell. Can somebody outline how I should approach this problem? 回答1: I use this Swift 3 code in my horizontal UICollectionView . func scrollViewDidScroll(_

UICollectionView contentOffset changes with custom layout

妖精的绣舞 提交于 2020-01-12 04:20:07
问题 I have a UICollectionView with a custom UICollectionViewLayout (actually, I'm using this nice layout). I set contentOffset = CGPointZero in viewDidLoad. After viewDidLoad, however, the offset is -20, and the content gets pushed down like so: (It should be flush with the line). I'm loading the collection view layout in interface builder. It seems that my problem is very similar to this one, however the solutions there don't work for me. I tried modifying collectionViewContentSize in my layout

How to interpolate custom UICollectionViewLayoutAttributes properties with UICollectionViewTransitionLayout

南笙酒味 提交于 2020-01-12 03:19:10
问题 I have two custom UICollectionViewLayout objects that use a custom UICollectionViewLayoutAttributes subclass. These custom attributes add a single property tintAlpha that controls the opacity of a tint overlay view attached to each collection view cell. I now want to transition between these two layouts, using a UICollectionViewTransitionLayout subclass. How can I configure the transition layout subclass to interpolate the custom tintAlpha property on my custom layout attributes? I could do

Decrease Space between UICollectionViewCells

隐身守侯 提交于 2020-01-11 13:27:51
问题 Objective I am trying to decrease the space between my UICollectionViewCells What I tried I tried subclassing UICollectionViewFlowLayout and overriding this method: - (NSArray *) layoutAttributesForElementsInRect:(CGRect)rect { NSArray *answer = [[super layoutAttributesForElementsInRect:rect] mutableCopy]; for(int i = 1; i < [answer count]; ++i) { UICollectionViewLayoutAttributes *currentLayoutAttributes = answer[i]; UICollectionViewLayoutAttributes *prevLayoutAttributes = answer[i - 1];

UICollectionViewLayout layoutAttributesForElementsInRect and layoutAttributesForItemAtIndexPath

↘锁芯ラ 提交于 2020-01-11 00:08:33
问题 I'm implementing a custom flow layout. It has 2 main methods for overriding to determine placement of cells: layoutAttributesForElementsInRect and layoutAttributesForItemAtIndexPath . In my code, layoutAttributesForElementsInRect is called, but layoutAttributesForItemAtIndexPath isn't. What determines which gets called? Where does layoutAttributesForItemAtIndexPath get called? 回答1: layoutAttributesForElementsInRect: doesn't necessarily call layoutAttributesForItemAtIndexPath: . In fact, if

How do I create a UICollectionView with column and row headers?

半世苍凉 提交于 2020-01-10 09:22:13
问题 I want to create a UICollectionView that looks like this: It won't be scrollable or editable. I'm currently wondering how to write the layout for this. I'm guessing it won't be a subclass of UICollectionViewFlowLayout . I can think of a number of ways, but was curious if there was any "right" way. The cells will be animate-able. Should each row or column be its own section? 回答1: I've done something like what you want with a subclass of UICollectionViewFlowLayout. It looks like this,

Delete cell from UICollectionView without reloading from top [closed]

百般思念 提交于 2020-01-09 09:04:11
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . 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

Delete cell from UICollectionView without reloading from top [closed]

 ̄綄美尐妖づ 提交于 2020-01-09 09:04:09
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . 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

Delete cell from UICollectionView without reloading from top [closed]

↘锁芯ラ 提交于 2020-01-09 09:02:43
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . 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

Auto Layout Collection view according to various screen sizes

大城市里の小女人 提交于 2020-01-05 05:28:05
问题 I'm using a collection view inside a normal view controller using the collection view delegate and data source. I'm using the sizeForItemAtIndexPath but it doesn't resize the cell. let screenSize: CGRect = UIScreen.main.bounds func collectionView(_collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { return CGSize(width: screenSize.width / 3, height: screenSize.width / 3) } The collection view is