uicollectionview

Adding a static cell to a UICollectionView

痴心易碎 提交于 2019-12-24 16:29:01
问题 I have a UICollectionView that displays cells from an array. I want the first cell to be a static cell that serves as a prompt to segue into a create flow (eventually adding a new cell). My approach would have been to add two sections to my collectionView, but I currently can't figure out how to return a cell within cellForItemAtIndexPath if I do so. This is my attempt: func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell

How to expand collectionview cell on didselect to show more info?

前提是你 提交于 2019-12-24 14:43:23
问题 I want to animate my collectionview cell so that when I touch it, a mapview slides out from underneath it and basically expands into the space, by pushing the cell underneath it down a little bit. I tried using this: UICollectionView: Animate cell size change on selection, but was unable to get it to work properly. Here what I tried. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [((FeedCell *)[collectionView

Scrolling horizontal and vertical both direction

▼魔方 西西 提交于 2019-12-24 13:22:15
问题 I have requirement to scroll the images horizontally and vertically. I have sections which will segregated vertically and in each section itself it will be so many images which will be scrolled horizontally . I made vertical scrolling using UICollectionView with Ray wenderlich tutorial but how do I get horizontal scrolling in each section? Should I use any other object like UITableView or UIScrollview for this purpose? Any tutorial available how to achieve this? Is it compulsory to implement

UICollectionView header view create programmatically and add?

五迷三道 提交于 2019-12-24 12:49:00
问题 I have created UICollectionView in storyboard and added header footer view its working fine.But My question is how to create UICollectionViewReusable view to add as SupplementaryView programatically.I tried but delegates not called.Please note that i have set delegate also.below code i have tried - (void)setUpCustomCollectionView { self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 40, 320, 500) collectionViewLayout:layout]; [self.collectionView registerClass:

UICollectionView received layout attributes for a cell with an index path that does not exist

只谈情不闲聊 提交于 2019-12-24 12:29:59
问题 I have used two collection views which name is cltnEdits and cltnTools , i am Displaying cltnTools by default. when user click on any item of cltnTools then cltnEdits collection view is appeared otherwise it will be hidden. there is one cancel button with cltnEdits , whenever user click on that cancel button cltnEdits is disappeared(Hidden) and cltnTools is appeared. My both Collection views are in UIStackView I am getting following error while selecting element from collection view which

Inserting a New Cell Into A UICollectionView

瘦欲@ 提交于 2019-12-24 11:51:39
问题 I’m trying to add in a new cell into my collection view, only if it has more than one item already in it. I have no worked much with collection views, and research in the docs and this site had not helped solve this issue yet. So, on my cellForItemAtIndexPath method, I do a check to see if it is populated. If not, I add the cell, like so: - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { if (self.myArray.count != 0) { return self

UICollectionView and push to detailViewController using Parse

断了今生、忘了曾经 提交于 2019-12-24 11:44:50
问题 I use the tapGesture method to pouch the image from UICollectionView to detailViewController viewController.h as follows: #import <Parse/Parse.h> @interface CardsViewController : UIViewController <UICollectionViewDelegateFlowLayout> { NSMutableArray *allImages; NSArray *cardFileArray; } @property (weak, nonatomic) IBOutlet UICollectionView *imageCollection and viewController.m as the follow - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } -

UICollectionView Scrolling is Very Choppy

安稳与你 提交于 2019-12-24 11:26:55
问题 The scrolling on my UICollectionView is really choppy. As I scroll past half the screen, it gets stuck for a moment and then proceeds. How can I make the scrolling more smooth using SWIFT? 回答1: Use Time Profiler instrument to find out where the bottleneck is. Swift has nothing to do with scroll view's performance. 回答2: There are two complementary ways: 1) [Fast way] When choppy effect is large enough for giving you time for pressing pause button on the debugger. And then review what is doing

how can we use UICollectionView without an UICollectionViewController

被刻印的时光 ゝ 提交于 2019-12-24 11:09:25
问题 Normaly, if we want to use UICollectionView , we must use an UICollectionViewController . But now I don't want, so how can I use UICollectionView without an UICollectionViewController ? 回答1: Of course you can use a UICollectionView without an UICollectionViewController . Just create a UICollectionViewLayout of your choice, and then call - (id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout to create a new instance of UICollectionView . Don't forget to set the

Issue with adding the collection view image to an array while passing data to another view

被刻印的时光 ゝ 提交于 2019-12-24 09:37:42
问题 I'm having a struct like so... struct ProductImage { let id : String let url : URL let isDefault : Bool } struct Product { let name : String let id : String var images = [ProductImage]() var theRate : String var quantity: String var sku: String var prdCateg: String var prodDescr: String init(name : String, id: String, theRate: String, quantity: String, sku: String, prdCateg:String, prodDescr: String) { self.name = name self.id = id self.theRate = theRate self.quantity = quantity self.sku =