uicollectionviewlayout

How to stack UICollectionView sections

£可爱£侵袭症+ 提交于 2019-12-23 08:29:08
问题 I originally tried doing this with two UICollectionViews stacked on top of each other. However getting it to scale right was nightmare with Auto-layout (I'm a novice iOS developer so that is more a critique of my skill than Auto-layou t). I'd like to stack two sections of UICollectionView cells on top of each other like this: +----------------------+ |+-Section 0---------->| | +-------+ +-------+ | | | | | | | | | | | | | | |Cell 0 | |Cell 1 |+-> | | | | | | | | | | | | | +-------+ +-------+

CollectionView Disappears within StackView (Swift)

假如想象 提交于 2019-12-23 03:42:08
问题 I'm trying to achieve the stackView arrangement shown in the middle of this figure:, but for some reason the top stack, containing a collectionView, disappears when using: a .fill distribution stackView.distribution = .fill (stack containing collectionView disappears) stackView.distribution = .fillEqually (collectionView appears fine in stackView) I've been struggling with this for days, and you'll see residues in my commented out sections: setting compressionResistance/hugging priorities,

CollectionView Disappears within StackView (Swift)

断了今生、忘了曾经 提交于 2019-12-23 03:42:07
问题 I'm trying to achieve the stackView arrangement shown in the middle of this figure:, but for some reason the top stack, containing a collectionView, disappears when using: a .fill distribution stackView.distribution = .fill (stack containing collectionView disappears) stackView.distribution = .fillEqually (collectionView appears fine in stackView) I've been struggling with this for days, and you'll see residues in my commented out sections: setting compressionResistance/hugging priorities,

UICollectionView custom horizontal paging layout

最后都变了- 提交于 2019-12-23 03:41:46
问题 [![collectionview example][1]][1] I am trying to emulate this behavior using a collection view. I have started by working with this method and it has gotten me closer. Although as I swipe further and further right on my horizontal paging CollectionView, the content shifts further and further left. Also the spacing between the cells is off. I believe it requires a custom layout, but am not sure. func collectionView(collectionView: UICollectionView, layout collectionViewLayout:

sizeForItemAtIndexPath getting called for all indexes before load - I am pretty sure I am either running into a UICollectionView bug OR a poor design

牧云@^-^@ 提交于 2019-12-22 19:32:32
问题 I am able to reproduce this on a very simple standalone app. I have a collectionView which I want to make circular/loop so the elements repeat again and again (aka when user is at the last element in array, it shows the first element again after. And if they are at the first and scroll left, it shows the last element again). So it's a never ending collectionView. So for a simple example, let's use days of week: ....Sunday, Monday, Tuesday, Wednesday..Saturday, Sunday, Monday.... In order to

How to slow down scrolling when showing preview of previous / next cell in UICollectionView?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 09:55:54
问题 I am aware that there're many questions was already asked for this issue. But most of the questions are outdated or with no answers. The problem with my implementation is not preview, but its pagination speed? I am able to show previous/next cell in UICollectionView but when I try to scroll it speedily, its scrolling (by skipping) 1 or 2 pages. This happens when I scrolling it at good speed. For a note, I'm using custom layout. This is my code: - (CGPoint

Using a UICollectionView to build a Monthly/Weekly calendar

被刻印的时光 ゝ 提交于 2019-12-22 01:28:03
问题 I want to build a calendar using a UICollectionView. The calendar should have two layouts: Weekly - 7 days with paging. Should be horizontally scrollable. Monthly - full month with paging. Should be horizontally scrollable. I want a "numbers only" calendar - something that works like the iOS native calendar (without the full daily schedule - just the numbers) The user should be able to move from layout to layout by dragging the bottom of the collection view (making the week bigger to see a

How can I dynamically resize a header view in a UICollectionView?

拈花ヽ惹草 提交于 2019-12-21 19:42:57
问题 I have header (a UICollectionReusableCell) in a UICollectionView whose height needs to be variable. How can I have it resize itself according to the height of its contents? I do not need to support iOS 7, and Autolayout solutions are preferable (if they exist). 回答1: This is how I solved it. I wish it was more elegant. Set the UILabel in the header view to have a numberOfLines value of 0. This will let it resize itself. Move the header out of the storyboard and into a xib. In collectionView(_

UICollectionView Cell Overlap

谁都会走 提交于 2019-12-21 09:12:24
问题 I have a horizontal UICollectionView. I want to make the cells overlap each other by a certain amount of 60 pixels so that the second cells overlaps the first by 60 pixels and the third overlaps the second by the same amount and so on. I tried sub classing UICollectionViewFlowLayout. But I am not able to place the UICollectionviewCell on top of one another. 回答1: Starting with this tutorial: https://web-beta.archive.org/web/20151116053251/http://blog.tobiaswiedenmann.com/post/35135290759

Customising position of header in UICollectionView layout causes NSInternalInconsistencyException error

烂漫一生 提交于 2019-12-21 08:48:31
问题 I am trying to customise the positions of the headers in a UICollectionView using a subclassed UICollectionViewFlowLayout class (based loosely on the code for stacked headers which is shown enter link description here). As a minimal test, let's say I just want to add a fixed offset to the position of all headers: I add all headers to the array returned by layoutAttributesForElementsInRect so that all are always processed (this may be the cause of the problem, I'm not sure) I then update each