Questions tagged [indexpath]

167 questions
0
votes
2 answers

crash while deleting rows from tableview

Hello i am i am deleting rows from tableview and its work fine for me i am successfully removed but after remove i am getting crash and error like below Error Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value and here…
Vishal Parmar
  • 615
  • 4
  • 31
0
votes
1 answer

Code conversion swift 2 --> 3 resulting in binary operator error at index path

Was using Xcode 7 with swift 2. App worked fine. Updated to Xcode 8. It automatically converted code from swift 2 --> swift 3. Now I have a problem with code for my Table view. Error is with this line of code: if (indexPath as NSIndexPath).row == 0…
user5740195
0
votes
1 answer

Reliably using UICollectionView indexPath to access dictionary keys?

I'm trying to use the current CollectionViewcell's IndexPath to access data from a dictionary. The dictionary's keys are of type Int. This CollectionView has "full page" cells, meaning that each cell takes up the full view area where I am using…
Renato Silva
  • 51
  • 10
0
votes
1 answer

Access button index from TableView inside another TableView

I have a TableView inside Another TableView, and the inner tableView contains buttons. I am able fire a method when click on button, but not able to get the indexPath. The app is getting crashed when I use the below code func tableView(_ tableView:…
Naval Hasan
  • 1,226
  • 1
  • 13
  • 18
0
votes
2 answers

Let only select specific cells with shouldSelectItemAt indexPath function

I want that only four specific cells can be selected at one time. When a button is pressed, I want that the selectable cells are 4 indexPath.row lower. Example: In the beginning, indexPath.row 44-47 is selectable. If the button is pressed I want,…
Just4School
  • 117
  • 1
  • 1
  • 9
0
votes
1 answer

Swift 4: Button triggers the same action in another UITableViewCell

I have a cell with 2 buttons (for listening and speech recognition), label, and textfield. What I am trying to achieve is when the speech recognition button is selected the user speaks the content that is displayed in a label. My issue with this is…
unknown
  • 3
  • 3
0
votes
0 answers

How to detect the index path in collection view

Let's see. I have collection view. I need to detect the index path of some element from datasource that still didn't load in cellForItemAt indexPath. I need it to scroll collection view to specific element that I want. The datasource includes…
Denis Windover
  • 445
  • 2
  • 6
  • 20
0
votes
1 answer

Get IndexPath from a UITableViewCell in a multiple sections UITableView to respond a Notification

I have a tableView with multiple sections and i want to show in a cell (via notification) the progress of a download that is being handle by Alamofire. Right now, i already have the notification post working and passing as info, an episode object,…
0
votes
3 answers

Assign UITableView Cell label text from Swift dictionary

I am trying to get a value from a swift dictionary to display as cell texts. I am getting error: Type 'Any' has no subscript members cell.audioLabel.text = audiofiles["filetitle"] <-line producing error I believe I may have set the variables…
Ron Modz
  • 41
  • 6
0
votes
2 answers

How can I securely delete Rows at indexPath

I think this Is a rather dumb question but I did not find any solution to securely delete Rows in my Table view. calendarTableView.deleteRows(at: indexPaths, with: .fade) I want to first check if there are any rows before I delete them because…
Noodledew
  • 509
  • 4
  • 19
0
votes
2 answers

Starting an Image array at the second index item in UICollectionView

I am trying to get the "var product" array to start populating the cells after the first UICollectionViewcell "newCell". newCell will always appear the same way and will always be present. productCell may have different names and labels and may not…
0
votes
0 answers

How to access UILabel in custom cell with indexPath and implement user data from array/ dictionary into the label

I have been trying to fix this for 4 days and still no luck so any help would be appreciated. I am trying to create a table view where workers can upload their profiles and users can scroll through to see which ones they like (see simulator photo).…
0
votes
2 answers

Access indexPath.row in button function Swift

I am trying to remove selected row with button. Therefore I need indexPath.row, I write value to global variable, but when I access it in button, it returns nil to me. var selectedRow = "" func tableView(_ tableView: UITableView, didSelectRowAt…
Jacob
  • 59
  • 9
0
votes
2 answers

How to set collection view cell of specific index in iOS Swift?

In profile screen retrieve data from firestore of user name, email id, car category. Here car category are compact, small, midsize and full. And storing carCategory parameter value as String (i.e: CarCategory: "1" that means car category is "0" then…
PvDev
  • 791
  • 21
  • 67
0
votes
1 answer

find middle cell in a collection view and change its content

My goal is to have full text in a middle cell and truncated text in other cells, but with change of middle cell this style should not change (means middle one full text and others truncated). Presets: Infinite scroll in horizontally scrolling…
Dake
  • 23
  • 8