uicollectionviewdelegate

Touch events on UICollectionView causing delegate methods to not be called

梦想的初衷 提交于 2020-01-14 04:05:52
问题 I have a UICollectionView set up in which I have cells. I want to tap these cells to play a sound, and also have the ability to drag these cells into a different view to drop those sounds in. To play sounds, I use the -collectionView:collectionView didSelectItemAtIndexPath method. And to implement the drag functionality, I used custom login in the touchesBegan, touchesMoved etc. methods. However, if I have the methods touchesBegan, touchesMoved, the UICollectionView delegate methods never get

Touch events on UICollectionView causing delegate methods to not be called

[亡魂溺海] 提交于 2020-01-14 04:05:35
问题 I have a UICollectionView set up in which I have cells. I want to tap these cells to play a sound, and also have the ability to drag these cells into a different view to drop those sounds in. To play sounds, I use the -collectionView:collectionView didSelectItemAtIndexPath method. And to implement the drag functionality, I used custom login in the touchesBegan, touchesMoved etc. methods. However, if I have the methods touchesBegan, touchesMoved, the UICollectionView delegate methods never get

Touch events on UICollectionView causing delegate methods to not be called

青春壹個敷衍的年華 提交于 2020-01-14 04:05:12
问题 I have a UICollectionView set up in which I have cells. I want to tap these cells to play a sound, and also have the ability to drag these cells into a different view to drop those sounds in. To play sounds, I use the -collectionView:collectionView didSelectItemAtIndexPath method. And to implement the drag functionality, I used custom login in the touchesBegan, touchesMoved etc. methods. However, if I have the methods touchesBegan, touchesMoved, the UICollectionView delegate methods never get

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

UICollectionView: How to define a UICollectionViewLayout that supports horizontally and vertically scrolling?

故事扮演 提交于 2019-12-17 17:33:21
问题 At the moment I'm trying to create an UICollectionView , that should display a simple excel-like-spreadsheet , with rows and columns . This should be an easy task with UICollectionViews , I believed. And I really would like to do the implementation in UICollectionView , not in any grid framework . But at the moment I'm hanging a little bit. What I've figured out is, that I unfortunately can't use a UICollectionViewDelegateFlowLayout , because this only supports scrolling in either

CollectionView nested inside Collectionview

*爱你&永不变心* 提交于 2019-12-12 23:12:23
问题 I have seen solutions where a collection view is nested inside a table view but for my app I need to have 2 collection views as it makes it easier to do some other things. So lets call the root collection view VerticalCollectionView which only scrolls vertically and the nested collection view HorizontalCollectionView which only scrolls horizontally. I created them using the Storyboard. Below you'll see the orange is the Vertical with the green Horizontal with a label inside it. And I have set

Why UICollectionView with UICollectionViewFlowLayout not show cells, but ask for size?

半城伤御伤魂 提交于 2019-12-11 18:24:07
问题 Why collectionview with flow layout sometimes not showing cells, but delegate ask for size, and section items count and responder give correct information. Here example, trouble with 6 section 2015-04-08 04:43:59.020 ASKED SECTION:0 ITEMS:0 2015-04-08 04:43:59.023 RETUR SECTION:0 ITEMS:1 2015-04-08 04:43:59.023 ASKED SECTION:1 ITEMS:0 2015-04-08 04:43:59.024 RETUR SECTION:1 ITEMS:1 2015-04-08 04:43:59.024 ASKED SECTION:2 ITEMS:0 2015-04-08 04:43:59.024 RETUR SECTION:2 ITEMS:1 2015-04-08 04:43

Adding UICollectionView inside UIView without Storyboards

巧了我就是萌 提交于 2019-12-06 15:13:23
问题 I have ViewController called myVC with UITablewView - myTable . What I want is to add some UIView as myTable's headerView from code . So inside viewDidLoad() method of myVC I added this code let topView = TopView() topView.frame.size.height = 100 topView.frame.size.width = myTable.frame.width myTable.tableHeaderView = featuredEventsView I also created file called TopView.swift that looks something like class TopView : UIView { override init(frame: CGRect) { super.init(frame: frame) self