uicollectionviewcell

UICollectionViewCell and UITextField text

余生颓废 提交于 2019-12-25 03:25:07
问题 I have custom UICollectionVIewCell with UILabel and UITextfield as it's property. They both IBOutlet to and connected in Storyboard. This cell get reused in a UICollection view. It get created depending on UILabel count array. So if array has three strings, this cell get created three times. User supposed to enter number in UITextfiled for relevant label. I want to save this number along with label in a dictionary. My problem is I can't get text from UITextfield. Don't know how to do that. I

UICollectionView Layout customization

怎甘沉沦 提交于 2019-12-25 03:08:45
问题 I have a lot of section and items. When I touch button in cell it create cell with 4 items in 1 cell (like expanded table) touch again cell disappear. I found WaterfallCollectionView and there I can change height of items. What is the best way to achieve this??? Structure like: ----- ----- | +| | +| and other rows | | | | ----- ----- When I touch my button (+) it should be like: ----- ----- ----- | -| |__|__| | +| | | | | | | | ----- ----- ----- A new cell create with 4 UIImageView's inside 1

why my stepper value inside collection view cell doesn't change?

半城伤御伤魂 提交于 2019-12-25 02:45:20
问题 I have collection view cell, and I have stepper and product name label inside the collection view cell. I have six products displayed on the collection view cell. I want to add the product to cart / order by tapping the Add To Cart Button. once the add to cart button is tapped, then the add to cart button will be hided and it will show the stepper, like the image below. here is my code for my collection view cell: protocol OrderCellDelegate { func stepperValueChange(at selectedIndexPath:

Dynamically handle the background and foreground colors inside UICollectionViewCell's elements

孤人 提交于 2019-12-25 02:33:44
问题 I have a UICollectionViewCell which contains a UIView enclosing a UILabel . I have to change the background color of UIView and the text color of UILabel on the base of a boolean value. The colors on the base of the boolean value work find unless I add the fourth item in the UICollectionView . All items from all previous and current cells get the same respective color like that of the items of the fourth cell as soon as I add the fourth item. The problem is exactly related to this but here I

Aligning right to left on UICollectionView with contents

空扰寡人 提交于 2019-12-25 01:39:16
问题 I tried with the following question: Aligning right to left on UICollectionView but it's not achieved my goal. What I was tried: In viewDidLoad() : collectionView.transform = CGAffineTransform(scaleX: -1.0, y: 1.0) In cellForItemAtIndexPath() : cell.transform = CGAffineTransform(scaleX: -1.0, y: 1.0) My current CollectionView is on the left, but I want it to look like the CollecitonView on the right. dataSource = ["item1","item2","item3","item4","item5","item6"] Update: Change

Swift -Animation in GradientLayer not appearing in cell

こ雲淡風輕ζ 提交于 2019-12-25 01:16:00
问题 I have different images of different foods that I add to a UIView (I choose to use an UIView instead of an UIImageView ). The original color of the images are black and I change them to .lightGray using .alwaysTemplate . // the imageWithColor function on the end turns it .lightGray: [https://stackoverflow.com/a/24545102/4833705][1] let pizzaImage = UIImage(named: "pizzaImage")?.withRenderingMode(.alwaysTemplate).imageWithColor(color1: UIColor.lightGray) foodImages.append(pizzaImage) I add the

Reload UICollectionViewCell which has image

前提是你 提交于 2019-12-24 18:53:27
问题 I am trying to create something like Facebook NewsFeed where, I am using custom UICollectionViewCell to display data (Text/Image) from JSON. I have 2 different APIs. One for text and another for images(Every cell doesn't have image). So, First of all I am getting all text values in to my cells from my textAPI and reloading myCollectionView. That works perfect. Now for the Images, I am using ImageFetcher to fetch images, func ImageFetcher(postId : NSNumber, completion : ((_ image: UIImage?) ->

Custom UiCollectionViewCell class init not being called

回眸只為那壹抹淺笑 提交于 2019-12-24 16:30:10
问题 Hi I'm using this code to try and make the text resize though I can't seen to get the label to resize. Also the init method in the custom class is not being called. Here is my code: class Cell: UICollectionViewCell { @IBOutlet weak var label: UILabel! override init(frame: CGRect) { super.init(frame: frame) print("init—>Not being called???\n") self.label.adjustsFontSizeToFitWidth = true self.cell.label.sizeToFit() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } } What

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

Add blur in UICollectionViewCell

孤街浪徒 提交于 2019-12-24 13:02:07
问题 I'm trying get a snapshot of a UICollectionViewCell, blur it and add as a subview to the UICollectionViewCell. Some weird problems are happening. MyCollectionViewController - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell<MyCollectionViewCellProtocol> *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MyCollectionViewCell" forIndexPath:indexPath]; cell.modelVariable = self