Questions tagged [indexpath]
167 questions
0
votes
0 answers
Scrollable Table View - scroll when needed
I have a scrollable tableView and I want to add tooltip some of these cells. For this, I made the necessary checks and kept the cellPaths as the row and section of necessary cells to which tooltips will be added.
My problem starts here: if I try to…

Furkan Ahi
- 1
- 2
0
votes
1 answer
tableView.indexPathForSelectedRow returns nil - Xcode 13.4.1 UIKit
please help me to understand why the tableView.indexPathForSelectedRow method returns nil.
I want to make a transfer from Table View Controller to View Controller. I have a segue by a StoryBoard and leadingSwipeActions.
import UIKit
class…

maxMas
- 49
- 7
0
votes
1 answer
"Thread 1: Fatal error: Index out of range" from an array initialized with a length of zero/empty but it's definitely not empty when requested
So I currently have a tableView in a ViewController called GearComponentViewController that has custom tableViewCells that have a UIStepper in them to control a quantity label and conforms to the custom protocol Stepper.
protocol Stepper {
func…

slimeforest
- 25
- 3
0
votes
2 answers
Cant get correct indexPath of collectionView cell
EDIT:
I try to get a correct indexPath of a current cell in a collectionView.
The project is simple: an album of photos and a label with a text. Text in label should be the current indexPath.
Concerning photos - everything is ok. Problem is with…

Sergey_VC
- 103
- 7
0
votes
2 answers
Make tableView display even and odd number of cell titles Swift
I am new to programming and Swift is my first programming language that I am learning, I apologize if the answer to the question is too obvious.
My app requires amount of players to be added and number of teams the user wishes to divide the players…

Chamoy
- 41
- 7
0
votes
0 answers
How can you ensure that cells are not duplicated when the device is overwhelmed by code from the previous page?
I have a problem that only occurs when page A has to run a massive amount of code and the user goes to page B before all the A page code is finished. In these instances, sometimes cells get duplicated(ie, say page B must be : User H in top, user F…

florida27
- 67
- 1
- 7
0
votes
1 answer
How to input the value from UI button in Teble View cell to the variable declared in Table View Controller?
I want to save the value of filled button(●) into the array "q.answer[indexPath.row]" about each question "q.question[indexPath.row]).
currentQuizButtonIndex is currently renewed every time when ◯ changes to ● by tapping. However, I have no idea how…

tasmicsy
- 99
- 2
- 10
0
votes
0 answers
How to use two custom types whilst still using indexPath.section and indexPath.row for UITableView
I have a database consisting of two tables. One holds MenuItem data and the other MenuCategory data. I written a simple SQL query to return all of the data from each table and then I've used this to decode the information into my own data…

colinsgone
- 11
- 4
0
votes
1 answer
Return Cell Based On Model Data In Switch Statement
I have a model that holds a bool value. I would like to return a UICollectionViewCell based on the value of the bool within the model using a switch statement. However, I am getting a casting error.
Could not cast value of type 'Project.FalseCell'…

David Henry
- 1,972
- 20
- 43
0
votes
0 answers
How to get the location/indexPath of a swipe gesture?
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "SavedExercise")
let swipeRight = UISwipeGestureRecognizer(target: self, action:…

user13736502
- 43
- 4
0
votes
1 answer
configuring location w/ UITapGestureRecognizer?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view
let tap = UITapGestureRecognizer(target: self, action: #selector(doubleTapped))
tap.numberOfTapsRequired = 2
…

user13736502
- 43
- 4
0
votes
1 answer
Use a for loop to set the titles for buttons
I want to use a for loop to set the titles for the button. What I am currently doing is not working. I thought using indexPath.row was working but it does not. The code is not compelling either. I would think there is a simple solution to implement…

joe buck
- 31
- 1
- 7
0
votes
1 answer
Make tableView cell with struct and data by indexpath
I already known how to make a basic tableView, below is my basic code
class ShoppingTableViewController: UITableViewController{
var description = ["D1", "299900", "D2", "P201712310000003000", "D3", "ASS+DfDFxSuu", "D10", "901", "D11",…

AmyLin
- 1
- 2
0
votes
2 answers
Index Path not placing image after being called
My swifts code goal is to place a image in the imageview pic in class customtv when the user imports a photo from the photo gallery. The code works if you hit the import button twice but on the first time the code does not work and nothing happens…

Sam Burns
- 65
- 1
- 10
0
votes
1 answer
Create generic function to get indexpath from table and collection view - iOS - Swift
I have a tableView and collectionView and to get indexPath i'm using below methods on tableViewCell and collectionViewCell (i dont want to use indexPathForSelectedRow/Item methods). Is there a way that I can make this generic?
Ideas please
// For…

Ashh
- 569
- 1
- 6
- 28