Questions tagged [indexpath]

167 questions
0
votes
1 answer

append tableview cell text label into a empty array

I want to take all of the index path ints displayed on the tableview cells. Right now there is numbers 1-5 on the cells. That is what should be appended to the array emptyA. I have tried to do a compact on the index path but that does not work. All…
Sam Burns
  • 65
  • 1
  • 10
0
votes
1 answer

Invalid update: invalid number of items in section 0. datasource updated first

I have read and looked over the several posts that mentions this. I tried my best to follow along but I am still having an issue. self.items.append(contentsOf: newItems) let newIndexPath = IndexPath(item: self.items.count - 1, section: 0) …
0
votes
1 answer

delete tableview cell from button inside it

I want my swift code to delete the tableview cell from the button inside the cell. If the user hits the delete button from the cell with the label containing 2 it should delete that cell. So you would see the cells of 0,1,3,4. The delete button…
0
votes
1 answer

Print indexpath row on label in each table view cell

In my swift code below each table view cell features a label. In that label I want to print the index path row. So in cell one the label should be 1 in cell to it should read 2. I tried to code cell.textLabel?.text = "(indexPath.row)" but that…
0
votes
1 answer

use button to add new utibableview cell to index path

In my swift code below i want to use the button bin to add another tableview cell to the current tableview. Right now 3 tableview cells are in the code when the code builds and runs. The button should have the 4 cell added and then also print 4 in…
0
votes
0 answers

index out of range while saving user data - Swift

To preface, I am new to programming and Swift. I am following a tutorial and am learning to save user data. Only when the save encoder/decoder functionality is enabled will this crash occur. Here is the encoding and decoding: override func…
cookiecutter
  • 147
  • 1
  • 7
0
votes
1 answer

How to pass specific value to a cell when that cell is selected?

In short how to call performforsegue method inside didselect row for indexpath. I have an array and this array is the contents of tableView `let array = ["USD","Inr", "AUD", "AED"]` and I have values for this array let valueUSD = "65" let valueInr…
0
votes
1 answer

Passing a value at indexPath in collectionView

I'm trying to pass the value at the indexpath to the next view controller but I'm unsure on how to do that. var imageStore = [Data]() var imageStoreReference = [(resultResponse, Data)]() func collectionView(_ collectionView: UICollectionView,…
Sola
  • 25
  • 6
0
votes
2 answers

Changing the title and the description below the collectionView cell When the collection view cell change. Doing this with index path is not working

I am updating the title and the description with the index path that i get when i cahnge the collection view index, But this is not doing the right things because when i scroll to end and start scrolling back the description and title associated…
0
votes
1 answer

drop the first element of the indexpath-> indexpath - 1

According to the docs, this should be as easy as this: let newIndexPath = indexPath.dropFirst(1). //This is not working though. What I have is a very complicated tableview ( I need to make my changes in cellForRow, anything else would…
valeriana
  • 161
  • 1
  • 16
0
votes
1 answer

Select cell from a saved indexPath

I am trying to create a tableview that selects the cell using an indexPath. I have saved the indexPath of selected cell & save it to my data array for each question. However when I reload the tableView how do I get the indexPath to change that…
Captain725
  • 73
  • 1
  • 7
0
votes
0 answers

Indexpath.row incremented by two values not one

Is it possible for tableview to skip an indexPath in cellForRowAt delegate? My logic is based on that the indexPath will always be incremented by one (because there will always be one cell on the screen). Should I change my logic? Status is 1 or -1…
Hassan Khan
  • 142
  • 1
  • 9
0
votes
0 answers

Keep selecting a cell in a collectionView even after collectionView.reloadData

hello everyone is definitely nonsense but I am confused when I try to select a cell from my collectionView. I need to save the selected indexPath and show it when my collectionView is reloaded. When I select a cell (after the collectionView has been…
kAiN
  • 2,559
  • 1
  • 26
  • 54
0
votes
1 answer

Remove elements from string array while in a for loop whose looping condition depends on string array size

I have a string array which I want to remove elements from depending on values in an indexPath array, generated from a 2 finger pan gesture over table rows. The loop repetition count depends on the size of the string array, and the relevant string…
Tirna
  • 383
  • 1
  • 12
0
votes
1 answer

Swift SearchBar inTableView doesn't show the correct Data in the filtered rows

My app is using Firebase Realtime Database to store information of each user. The tableView works fine. I added a searchBar and when I type letters in the searchBar, I can see that the amount of rows presented in the tableView is equal to the amount…