Questions tagged [indexpath]

167 questions
2
votes
3 answers

how to check indexpath.row == 4 * n by n += 1

Problem Statement : I want to dequeueReusableCell "PromotionCellIdentifier" cells everywhere indexPath.row == 4 * n but it only run dequeueReusableCell "PromotionCellIdentifier" one time . I need a solution. It have only dequeueReusableCell…
2
votes
3 answers

How to make IndexPath rawRepresentable?

I am trying to refactor code and create an enum class to hold indexPath of table view cells. I would like to make the code works this way: enum TableViewCell: IndexPath { case shopImageView = [0,0] case selectShopImageButton = [0,1] } But…
gd08xxx
  • 338
  • 4
  • 11
2
votes
2 answers

Append Array Through If Statement

So, I am making an app that requires to select various things. You can select these by swiping to the right of the UITableView. I am using a UIContextualAction and I am using a switch statement to order out the functions and executable statements.…
Jorge Zapata
  • 101
  • 7
2
votes
1 answer

Set a circle label for a separate Cell of CollectionView [Swift]

I'm trying to draw a circle for a visible cell of CollectionView, look like this I tried to make it trough addSubview and then removeFromSuperview the previous label, but it doesn't work let myIndex1 = IndexPath(row: 0, section: 0) let…
Diana
  • 683
  • 1
  • 8
  • 17
2
votes
2 answers

Access to array's indexPath in a function Swift

I am trying to access an array's indexPath inside a function to update this array's data but I don't know how to pass the indexPath as a parameter (espacially what to pass when calling) to the function or if this is even the solution. I included…
Wizzardzz
  • 781
  • 1
  • 9
  • 32
2
votes
1 answer

ScrollToRow does not work when said row is near the bottom of the table view

I have a cell class which implements a textfield delegate. In this delegate I am calling a function to tell the tableview to scroll to a specific row based off an indexPath. This works in most cases but not when the row is at the bottom of the table…
user2363025
  • 6,365
  • 19
  • 48
  • 89
2
votes
2 answers

iOS Collection View Change Cell content on didSelectItemAt indexPath

I need to access to the particular cell and change its content dynamically on didSelectAt indexPath func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if collectionView ==…
shubh14896
  • 156
  • 1
  • 12
2
votes
5 answers

Disclosure indicator to specific cell in static TableView in Swift

I created a static TableView and I would like to add or remove a disclosure indicator depending if we are consulting our own account or a guest account. This is what I would like : let index = IndexPath(row: 4, section: 0) let cell =…
KevinB
  • 2,454
  • 3
  • 25
  • 49
2
votes
2 answers

'Request for rect at invalid index path' exception on cell tap

I'm working on search bar with autofill feature. Sometimes I get this errors when tapping cell in autofill TableView: *** Assertion failure in -[UITableViewRowData rectForRow:inSection:heightCanBeGuessed:], …
BadCodeDeveloper
  • 455
  • 5
  • 24
2
votes
2 answers

How to get section of UITableView from inside a child UICollectionview

I have a UITableView with a UICollectionView within each of its rows like the illustration below. source: https://ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell-in-swift/ The intention of my app is to display a character set of…
Danoram
  • 8,132
  • 12
  • 51
  • 71
2
votes
3 answers

UITableViewCell's background settings are reset on scroll

I have a UITableView Controller in my project. So I made a UITableViewCell setup like here: override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell =…
1
vote
2 answers

How to prevent a UITableViewCell from moving (Swift 5)

This is actually a two part question. First take a look at the code: //canEditRowAt func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { if tableView.tag == 1000{ return indexPath.row == 0 ? false : true …
jmsapps
  • 388
  • 2
  • 17
1
vote
2 answers

How do I use a table view to go to different view controllers?

I have a tableview with one prototype cell. I can get multiple cells to appear with the proper content whenI run the app. I want each cell to navigate to a different view controller, rather than the same view controller simply displaying different…
1
vote
1 answer

collection view list cell when the cell is added / deleted, how to update the indexPath of the cell?

I'm working on the collection view list cell and I was wondering how to update the indexPath when I use the diffable data source and snapshot on iOS14. In my ViewController's viewdidload, I called configureDataSource method which registers cell…
Yuuu
  • 715
  • 1
  • 9
  • 32
1
vote
1 answer

collectionView doesn't scrollToItem - swift - programmatically

I have a UICollectionview set inside a UIView in this way: videoCollectionView.delegate = self videoCollectionView.dataSource = self self.playerView.insertSubview(videoCollectionView, belowSubview:…
StackGU
  • 868
  • 9
  • 22
1
2
3
11 12