uicollectionview

How to rotate an Image on touch and Drag image over another Image

∥☆過路亽.° 提交于 2019-12-23 17:16:04
问题 I'm developing an app where I need a gallery which will have many images. And what I want to do is when user Tap/click on any image it should rotate that image to 90 degree, And if user drag any image to the top of any other image then those images should switch their places (or we can say swap places with each other). Explanation: A B C D E F Suppose above is the images of my gallery so if user drag image A on top of image E then gallery should look like this E B C D A F I'm using

iOS - UICollectionView still have spacing between cells after set to 0

自闭症网瘾萝莉.ら 提交于 2019-12-23 16:12:39
问题 Im getting small spaces between cells when setting everything to 0. All I did in the cellForItemAtIndexPath is setting backgroundColor for each cell. Here's my code: //collectionView frame _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 150) collectionViewLayout:layout]; ... - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { /

How to dynamically add labels and buttons in section header of UICollectionView?

给你一囗甜甜゛ 提交于 2019-12-23 15:57:46
问题 Please help me how I can add labels horizontally and similarly buttons horizontally but each button should align at down of each label like a another section. This should happen dynamically in the header of the UICollectionView as the number of labels and buttons is according to my data. I want to make a excel kind of layout and in header I want to show the above controls. Thanks in advance! I have done this- - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView

DIfferent Scroll direction for multiple sections of Collectionview in swift 2

风流意气都作罢 提交于 2019-12-23 14:01:48
问题 I have an app with UICollectionView with 2 sections.My requirement is to have the first section should scroll in horizontal direction with one row only, while the second should scroll in vertical direction.I am working with Swift 2.1. Please advice some solutions. 回答1: Your UICollectionView with 2 sections Section 1: have only one UICollectionViewCell will contain a UICollectionView (horizontal direction) defined by its datasource. Section 2: your current datasource. You can check this one:

scrollToItem at indexPath at .top hides cell under header when sectionHeadersPinToVisibleBounds

天大地大妈咪最大 提交于 2019-12-23 13:11:45
问题 Using the following configuration: let layout = UICollectionViewFlowLayout() layout.sectionHeadersPinToVisibleBounds = true let collectionViewController = UICollectionViewController(view.bounds, collectionViewLayout: layout) The following code will scroll to the given index path but the item will be under and covered by its header: let indexPath = IndexPath(section: 0, row: 2) collecitonView.scrollToItem(at: indexPath, at: .top, animated: true) How do I get the collection view to scroll to

UICollection View causes “UICollectionViewFlowLayoutBreakForInvalidSizes” on smaller devices

蓝咒 提交于 2019-12-23 13:03:58
问题 On an iPhone 6 Plus, the collection view cells are fine, but when testing on another device size like the iPhone 5, i'm bombarded with " 017-06-15 01:59:25.744 HyperTest[3865:8825385] The behavior of the UICollectionViewFlowLayout is not defined because: 2017-06-15 01:59:25.744 HyperTest[3865:8825385] the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values. 2017-06-15 01:59:25.745

How to get the index path of a UICollectionView header?

♀尐吖头ヾ 提交于 2019-12-23 12:28:25
问题 Using the view's indexPathForItemAtPoint, I will get an index path for a cell, but never a UICollectionReusableView (header/footer) -- as it always returns nil. 回答1: You should make your own dictionary mapping index paths to header views. In your collectionView:viewForSupplementaryElementOfKind:atIndexPath: method, put the view into the dictionary before returning it. In your collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath: , remove the view from the dictionary.

UICollectionView bad acces on -> UICollectionViewData _setLayoutAttributes:atGlobalIndex:

半城伤御伤魂 提交于 2019-12-23 11:56:40
问题 I use an UICollectionView to display a lot of images with a batch of 32. Every time the i reach the end of the collection view i load an other batch of 32 images and resize the collectionView contentsize.width to accepte the new items. The loading is made by calling a webservice with AFNetworking. When i scroll very fast from the start to the end and to the end to the start i receive a EXC_BAD_ACCESS. It also happend when a reach the end of the CollectionView. It's like it tries to load some

collectionView:cellForItemAtIndexPath: never gets called

℡╲_俬逩灬. 提交于 2019-12-23 11:03:08
问题 I have a UICollectionView and I simply want it to show up. I have the delegate and datasource attached to the file's owner in the interface builder. collectionView:numberOfItemsInSection: Gets called just fine. I have been messing with this for a few hours and just can't figure it out... Any help would be great, Thanks in advance! Here is the full source. Sorry if its kinda messy. .h File #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import "PinAnnotation.h" #import "Jot.h" @interface

collectionView:cellForItemAtIndexPath: never gets called

人盡茶涼 提交于 2019-12-23 11:02:31
问题 I have a UICollectionView and I simply want it to show up. I have the delegate and datasource attached to the file's owner in the interface builder. collectionView:numberOfItemsInSection: Gets called just fine. I have been messing with this for a few hours and just can't figure it out... Any help would be great, Thanks in advance! Here is the full source. Sorry if its kinda messy. .h File #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import "PinAnnotation.h" #import "Jot.h" @interface