uicollectionviewcell

How can I parse each items into it's on uicollection view cell

我的梦境 提交于 2019-12-14 03:28:05
问题 So below is my code for parsing JSON and putting it into a collection view cell import UIKit let cellId = "cellId" struct AnimeJsonStuff: Decodable { let data: [AnimeDataArray] } struct AnimeLinks: Codable { var selfStr : String? private enum CodingKeys : String, CodingKey { case selfStr = "self" } } struct AnimeAttributes: Codable { var createdAt : String? var slug : String? let synopsis: String? private enum CodingKeys : String, CodingKey { case createdAt = "createdAt" case slug = "slug"

Check Boxes in CollectionView are changing positions when scrolling

家住魔仙堡 提交于 2019-12-14 03:25:05
问题 I have collectionView (3*3) with Images I am loading from server and I placed a checkBox in the top left corner of each cell so that I can select the cells and based on the selected cells I will get ids for the respective cells images(ids coming from server) and I am able do everything right. But, the problem is if there is are 20 images and if I check the 5 random cells which are loaded for the first time and when I scroll down to select other cells 5 other random checkBoxes are already

Strange behavior when user scrolls the list of UIViewCollectionCells in my app (the data in each cell changes randomly)

不问归期 提交于 2019-12-14 03:08:04
问题 In my app I'm using UICollectionView and I've decided to use it as in the code below: class UserList: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate { @IBOutlet weak var tview: UICollectionView! let reuseIdentifier = "cell" var items = NSMutableArray() func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = tview.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath:

How to save text field value in uicollectionviewcell

点点圈 提交于 2019-12-14 02:18:21
问题 hi i have text field in uicollectionviewcell so what i need it example : when i edit text filed value in row 5 and i done it and go to text filed in row 20 to edit value the collectionview has reloaded and forget value in row 5, so i need way to save value temporarily while do I change it manually this my code : cell.foodNumber.tag = indexPath.row if let foodcodes = self.menu![indexPath.row]["code"] as? NSString { if contains(self.indexPathsForSelectedCells, indexPath) { cell

How to get selected IndexPath from a stepper located inside a collection view cell?

[亡魂溺海] 提交于 2019-12-13 19:55:01
问题 I have collection view that has stepper inside the collection view cell used to increase the number of product like the image below. I need to know, when I click a stepper on a collection view cell. how do I know the indexPath.item of that collection view cell? so I can modify the data using the selected indexPath in the View controller? so If I change the stepper in the second cell, I will always get indexPath.item = 1 I previously think that the indexPath will come from didSelectItemAt

Swift 3: Cant programmatically create label on Collectionview header properly?

Deadly 提交于 2019-12-13 17:19:48
问题 Alright, so Im working in Swift 3 here and Im new to uicollectionviews. I am trying to programmatically add a label as a subview of a header UICollectionReusableView in my collection view. I have added the label like any other view, but I cant for the life of me CENTER the label on the header. Here is my label code in the custom header class, which is added to the header in the storyboard: let pointsLabel = UILabel() override init(frame: CGRect) { super.init(frame: frame) self.customInit() }

how to use custom cell in collection view controller in swift 3

不羁的心 提交于 2019-12-13 14:15:28
问题 I am using swift 3 - I know how to show some Images in collection view with custom Cell - the problem is that I can't use custom cell in Collection View Controller here is the collection view Controller Codes private let reuseIdentifier = "uploadCell" class uploadedFiles: UICollectionViewController { var images = ["1.jpg" , "2.jpg" , "3.jpg" , "4.jpg" ] override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell =

Scroll View in UITableViewCell won't save position

浪尽此生 提交于 2019-12-13 08:10:55
问题 I have some UIScrollView s in my UITableView . My problem is that if I scroll the scroll view in the first cell to another position, the fourth cell will also be at that same position. Same for the second and the fifth, the third and the sixth... Is there a way for the scroll views in the cells to keep their position? 回答1: You should save the actual content offsets of your UIScrollView s in an array, retreive the value after a scroll happened in a custom delegate and set the offset to the

How to set Flow layout for this scenario using UICollectionview?

夙愿已清 提交于 2019-12-13 07:29:40
问题 I Wanted to design the UICollectionview both portrait and landscape mode.Here i am using UICollectionViewFlowLayout I have entered my view controller code import UIKit class ViewController: UIViewController,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout { @IBOutlet var collectionObject: UICollectionView! var isOrientation = true let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout() override func viewDidLoad() { super.viewDidLoad() // Do

UICollectionView don't show the cell

六眼飞鱼酱① 提交于 2019-12-13 04:35:48
问题 There is UIViewController which contain UICollectionView . Also there is UICollectionViewCell which has own class & XIB (CurrentCell.h, CurrentCell.m, CurrentCell.xib). In my UIViewController.h : @property (strong, nonatomic) IBOutlet UICollectionView *collection; In my UIViewController.m : @synthesize collection; In viewDidLoad : [self.collection registerClass:[CurrentCell class] forCellWithReuseIdentifier:@"cellCurRecipe"]; UICollectionViewFlowLayout *flowLayout = [