Questions tagged [indexpath]

167 questions
0
votes
2 answers

How to get a image's indexpath in CollectionView in TableView?

In my program, each row of TableView has a Collection, each CollectionView has several Images. I have set Tag and UITapGestureRecognizer for the image in the collectionView(_:, cellForItemAt:) method, but Tag can only represent the position of the…
K.B.
  • 291
  • 2
  • 13
0
votes
2 answers

IOS/Swift: Pass Object in tableview to detail view controller

I am trying to grab an object from a tableview and pass it to a detail view, something I know how to do in Objective-C but am learning for first time Swift. However, my code is not getting the row from the index path or object. Here is my…
user6631314
  • 1,751
  • 1
  • 13
  • 44
0
votes
1 answer

(Swift) UITableView - Attempt to move index path to index path that does not exist

I have a UITableView consisting of 2 sections. Rows are initially printed in section 0. They must be moveable between sections. When I move a cell from section 0 to section 1, I get: "Attempt to move index path to index path that does not…
Nathaniel
  • 70
  • 1
  • 10
0
votes
2 answers

Swift: indexPath of cells using sectionNameKeyPath

Currently, I just started using sectionNameKeyPath from NSFetchedResultsController in Swift's core data / Initially, I didn't know how to separate the different cells into their respective dates. But now that I've separated the cells into the…
user8276400
0
votes
1 answer

persist array of UINib

I have an issue and I can't find any information out there... The thing is I have an Array of custom UINibs which each have their standard Class after I created them as a CustomTableViewCell. import UIKit class TestCell1: UITableViewCell…
Michael
  • 5
  • 4
0
votes
2 answers

how can I refer to UILabel or UIButton collections indexPath in array

@IBOutlet var buttons: [UIButton]! @IBOutlet var labels: [UILabel]! @IBAction func cevapSeçildi(_ sender: UIButton) { if sender == buttons[0] { `enter code here` labels[0].backgroundColor = UIColor.yellow } } I want this…
Samm Hadji
  • 15
  • 7
0
votes
4 answers

Swift- Converting Index path array to Int array

I'm trying to produce an array of selected values from a UICollectionView in swift 4. Im using the self.collectionView.indexPathsForSelectedItems method which returns the selected items as an Array of type index path. For example if elements 0 and 2…
Phil
  • 151
  • 9
0
votes
0 answers

Method integer parameter always returning 0

I have a loop that runs methods with 2 parameters. However, the indexPath parameter always equals 0 after the if statement but not before. ArrayList containers2 = new ArrayList<>(); containers2.add(dayNameContainer); …
Luke C
  • 140
  • 2
  • 12
0
votes
0 answers

Best way to pass the indexPathForSelectedRow from one VC to another?

I'm trying to access the IndexPath of the selected cell of an UITableView, but it isn't in the same ViewController. How can I achieve this? func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) { …
Abisanth11
  • 15
  • 5
0
votes
2 answers

Collection View terminates after cellForItemAtIndex

import UIKit import Photos class GalleryController: UICollectionViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { var Receipts = [UIImage?]() //Number of…
J.David
  • 1
  • 4
0
votes
1 answer

Why IndexPath is different in clouser

I have custom CollectionView cell and on button tap I am calling closure which is implemented under cellForItem below is code cell.closeImageTappped = { [weak self] cell in guard let strongSelf = self else { return …
Prashant Tukadiya
  • 15,838
  • 4
  • 62
  • 98
0
votes
2 answers

Get next cell in UIcollectionView in Swift

I need to get the next cell inside cellForItem within a collection view so that I can update a view object. When I try the following below it doesn't work. I've also tried indexPathForVisibleItems passing in indexPath.row + 1 and the produces an…
user7684436
  • 697
  • 14
  • 39
0
votes
0 answers

Swift Location For Item At Index Path?

I'm using a collection view and I'm trying to set up peek & pop to work with it. I've overridden: func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? I'm trying…
Logan
  • 1,172
  • 9
  • 23
0
votes
2 answers

Index path of a collection view cell that is inside of a table view cell

I have a UICollectionView nested inside of a table view cell. How can I get the index path of the horizontal row of the collectionview cell? I tried to use let index = cell.tag print(index as Any) to print which index was being…
ILoveToCode22
  • 235
  • 1
  • 3
  • 12
0
votes
3 answers

How to get selected table view cell row in segue?

I am developing an iOS app using Swift and I have a view controller that segues from a table view cell content view by selecting a cell row or selecting a button inside of that cell row's content view. The original view controller that contains the…
Marko Cain
  • 15
  • 1
  • 5