uicollectionviewcell

Autosizing Cells in UICollectionView (all in code)

Deadly 提交于 2019-12-11 14:59:56
问题 Using Swift-5.0, Xcode-10.2, iOS-12.2, There is an issue in my code while trying to achieve "autosizing" of cells in a UICollectionView (using UICollectionViewFlowLayout as its layout). The height of the cell is content-based (and unknown upfront) - therefore I try to get the cell's height to autosize (the "width" I don't care for now and can, for example, be set to frame.width ). Even tough, I only use one large UICollectionView-Cell for the example below, I would still like to keep

Option selected from one of the picker view duplicates in another picker view Swift

老子叫甜甜 提交于 2019-12-11 14:29:44
问题 I've a survey with 8 questions and each question has a picker view with options loading from the server. This is in the UI Collection View. The survey works fine upto 5 questions but when we added more than 5, whatever the option we pick for the question 1 gets selected both for question1 and 6. same with question 2 and 3 which returns Index out of range error and I see only 5 answers instead of 8. Any help is appreciated. Gif file of the CollectionView Errors Screen shot Here is my code:

How to fix an Incompatible pointer for subclass of UICollectionViewCell

耗尽温柔 提交于 2019-12-11 13:17:42
问题 I've implemented a subclass SPCell of UICollectionViewCell which I am using to create cells in my UICollectionViewController . Now, when I gather a cell, in order to do something with it, I get a warning Incompatible pointer types initializing 'SPCell *' with an expression of type 'UICollectionViewCell *' Here is an example. My custom cell holds an image, which I want to change the alpha value. But in the line, where I assign the cell, I get this warning. - (void)collectionView:

Design for annotating UICollectionView selections with additional controls

故事扮演 提交于 2019-12-11 12:57:19
问题 Using UICollectionView and excellent help given on here on StackOverflow, I've been able to build a "Gantt Chart" style control for my iPhone: Cosmetics aside (I'm doing the functional right now, I've got a graphics designer on tap to look at colors and all that). Background aside, the spans were relatively straightforward to do with a custom UICollectionViewLayout subclass. Each span is an item . But I need to add some functionality, and am unsure how to proceed. Where I'm trying to go is

Adding UIButton in each UICollectionViewCell in Scrolling Filmstrip within UITableView

天涯浪子 提交于 2019-12-11 12:46:36
问题 First off, let me describe the scenario I've got so far. Here's the basic rundown of how my UICollectionView in Scrolling Filmstrip style within UITableView works: Create a normal UITableView with a custom UITableViewCell Create a custom UIView that will be added to the cell's contentView The custom UIView will contain a UICollectionView The custom UIView will be the datasource and delegate for the UICollectionView and manage the flow layout of the UICollectionView Use a custom

Double tap Gesture on UICollectionViewCell?

China☆狼群 提交于 2019-12-11 12:17:40
问题 I want to double tap on the UICollectionViewCell to like the profile just like OkCupid App . I have applied Tap Gesture on Collection View but it does not work. When I try to double tap the cell every time didSelectCollectionViewCell Method call. 回答1: You have to add the double tap gesture recognizer to the collection view instead of the cell. In its action selector you could determine which cell was double tapped override func viewDidLoad() { var doubleTapGesture: UITapGestureRecognizer =

Collection View Cell multiple item select Error

馋奶兔 提交于 2019-12-11 11:19:42
问题 I have a Collection View & I want to select more than one item. For that I'm using - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [self.selectedAsset addObject:self.assets[indexPath.row]]; UICollectionViewCell* cell=[self.collectionView cellForItemAtIndexPath:indexPath]; cell.contentView.backgroundColor = [UIColor blackColor]; } This method to add objects to selectedAsset NSMutableArray. This is the cellForItemAtIndexPath method.

Sharing code between UITableViewCell and UICollectionViewCell

瘦欲@ 提交于 2019-12-11 11:13:14
问题 I have a pretty big UITableViewCell subclass which handle various gestures and stat behavior. I'm also building a UICollectionView, my UICollectionViewCell subclass behavior is pretty close to my UITableViewCell. I've pasted a lot of code from it. My questions is: Is there is a design pattern that would allow me to have the UI code (gesture and state) shared between those 2 subclasses ? I've heard of the composition pattern, but I have hard time fitting it for this case. Is it the right

Setting UICollectionViewCell size when cell is using AutoLayout

自闭症网瘾萝莉.ら 提交于 2019-12-11 11:03:01
问题 I have a UICollectionViewCell that has a dynamic height. It contains a UIWebView that loads some content asynchronously. After load, it needs to resize itself to accommodate its contents. I do the cell resizing by changing the height constraint of the web view . I also send a delegate method to the collection view controller that the cell has resized and I need to invalidate layout. However, I am getting auto layout errors about conflicting constraints. It seems the collection view is trying

UITableView inside UICollectionViewCell

半腔热情 提交于 2019-12-11 09:24:26
问题 I want to have UITableView inside my UICollectionViewCell. I would then dynamically change the content of UITableView through the subclass of UICollectionViewCell. My subclass of UICollectionViewCell .h looks like this: @interface ShopCollectionCell : UICollectionViewCell <UITableViewDelegate, UITableViewDataSource> @property (nonatomic, weak) IBOutlet UILabel *myLabel; @property (weak, nonatomic) IBOutlet UITableView *tableView; @end in .m is just standard UITableView methods: - (NSInteger