uicollectionview

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

Initializing a custom UICollectionViewCell

霸气de小男生 提交于 2019-12-22 09:07:51
问题 I have a custom UICollectionViewCell that has a custom background view which is drawn using one of several colour schemes. The colour scheme for the background view is set in my custom initializer -(id)initWithFrame:andColourPalette: for the View. I have a similar custom initialiser in my UICustomViewCell subclass but I can't figure out how to call this initialiser when I am setting up the cell in cellForItemAtIndexPath: Can anyone help me do this? Or offer alternative solution for passing

Why UICollectionView didSelect method does not work?

廉价感情. 提交于 2019-12-22 07:58:17
问题 I've created my UICollectionView programmatically and in this case my didSelectItemAtIndexPath method does not call at all. let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: CGRectGetWidth(self.view.frame), height: 360), collectionViewLayout: layout) collectionView.delegate = self collectionView.dataSource = self collectionView.userInteractionEnabled = true So, what is a problem? Why when I tap on the cells I do not get my response? func collectionView(collectionView:

Why is AutoLayout not taking care of my UICollectionView

牧云@^-^@ 提交于 2019-12-22 05:46:06
问题 I have built a very simple sample of an app (Source code on github) using a UICollectionView . Everything is working fine, as long as the app is in portrait mode. When it is changed to landscape mode however, the content cell is not resized appropriately, and thus, nothing is displayed. I thought that all the necessary AutoLayout constraints are in place. I am aware that I can implement collectionView:layout:sizeForItemAtIndexPath: , but my goal is to use AutoLayout as much as possible

Drag and Drop Image from UICollectionView to UIView?

♀尐吖头ヾ 提交于 2019-12-22 05:43:12
问题 Is it possible to drag an image from a collectionViewCell into a UIView? I am creating a game where the user can pick a number of items to play with in the next VC. I'm representing each item as an image and the user can select each item by dragging the image to bottom of the screen. The image would then be reset to its original location. If I have the UICollectionView functions in my code, with the image selected in a class of UIViewCollectionView all set up correctly... What do I need to

UICollectionView Insertion animation curve

邮差的信 提交于 2019-12-22 05:14:00
问题 Is it possible to adjust the animation curve for inserting indexPaths into a collectionview? I am currently animating the insertion of items using this methods: -initialLayoutAttributesForAppearingItemAtIndexPath: However, I'd like the change the animation curve with which the layout animates items. Is this possible? 来源: https://stackoverflow.com/questions/26662779/uicollectionview-insertion-animation-curve

How To Show Scrollbar Always On UICollectionView

喜夏-厌秋 提交于 2019-12-22 04:43:22
问题 I have a UICollectionView added to a UIView in an app I am working on. Displayed in the UICollectionView I have a set of images pulled from Core Data. The vertical scrolling works fine but the scrollbar does not display until the user touches the UICollectionView. How can I make sure the scrollbar at the right is always visible so that an indication is given to the user that it is scrollable? 回答1: You can't make them always visible. Instead, you can flash them once, when the user is first

How to select CollectionView cell in RxSwift

怎甘沉沦 提交于 2019-12-22 04:13:07
问题 I need to select the item at specific index in collection view using RxSwift.This method is not working fine. collectionView.rx.modelSelected(SearchResult.self).subscribe(onNext:{ menuItem in }).addDisposableTo(disposeBag) Can anybody help? 回答1: If you want the indexPath of item selected you can use the following : collectionView .rx .itemSelected .subscribe(onNext:{ indexPath in //your code }).disposed(by: disposeBag) and if you want to the model being selected : collectionView .rx

How to make UICollectionViewFlowLayout itemSize dynamic for screen size

谁都会走 提交于 2019-12-22 02:03:19
问题 I am working programmatically (no storyboard) and am having trouble making layout.itemSize dynamic for different screen sizes. I get this error message: "UICollectionView must be initialised with a non-nil layout parameter" with the following code in my implementation file: - (instancetype)init { UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; CGSize size = self.collectionView.bounds.size; layout.itemSize = CGSizeMake(size.width, size.height); [layout

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