Questions tagged [nsindexpath]

The NSIndexPath class represents the path to a specific node in a tree of nested array collections in Objective-C. This path is known as an index path.

Each index in an index path represents the index into an array of children from one node in the tree to another, deeper, node. For example, the index path 1.4.3.2 specifies the path shown below:

enter image description here

iOS adds programming interfaces to the NSIndexPath class of the Foundation framework to facilitate the identification of rows and sections in UITableView objects. The API consists of a class method and two properties. The indexPathForRow:inSection: method creates an NSIndexPath object from row and section index numbers. The properties return the row index number and the section index number from such objects

Resource

509 questions
-1
votes
3 answers

How to tell at what the IndexAtObject or IndexPath is of 2 compared NSArray 's. iOS. Objective C

I have 2 NSArray 's . Like this: NSArray *array1 = [NSArray arrayWithObjects:@"Frog", @"Cat", @"Dog", Pig]; NSArray *array2 = [NSArray arrayWithObjects:@"Pig", @"Dog", @"Cat",@"Rabbit",@"Hen", nil]; NSMutableArray *intermediate = [NSMutableArray…
CapeFurSeal
  • 183
  • 2
  • 13
-1
votes
1 answer

Get indexPath of recent row add in UITableView

I have a problem: I want to get indexPath of recent cell added on UITableView. Here is my code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //[_tableView clearsContextBeforeDrawing]; …
NGOT
  • 149
  • 5
  • 12
-1
votes
3 answers

How to move to the next row of tableView by Button

Here is my problem: By pushing a button on the DetailViewController I want to receive the data of my next row. Here is what I tried so far: -(IBAction)next:(id)sender { question.text = [questions objectAtIndex:indexPath.row+1]; } But now it takes…
hEgg
  • 29
  • 7
-1
votes
1 answer

storyboard NSIndexPath

I try use storyboard with table view that segue to controller view that should show me picture. The problem is that the app crush when I press on any "cell". this is the problem code: - (void) prepareForSegue:(UIStoryboardSegue *)segue…
Dennis
  • 704
  • 1
  • 9
  • 25
-2
votes
1 answer

Use objectAtIndex:indexPath.row in ViewDidLoad

I use an array (self.tableData) with objectAtIndex:indexPath.row for retrieving NSString. Here is my code : Person *person = [self.tableData objectAtIndex:indexPath.row]; cell.textLabel.text = person.fullName; I would like to use person.fullName;…
xcode_Dev
  • 237
  • 4
  • 16
-2
votes
1 answer

How can I get the "row" from indexPathsForSelectedRows?

I am trying to get the "row" value from indexPathsForSelectedRows. NSArray *selectedCells = [self.storeTableView indexPathsForSelectedRows]; NSLog(@"%@",[selectedCells objectAtIndex:0]); This NSLog prints out
Eric Chuang
  • 1,017
  • 9
  • 28
-2
votes
2 answers

iOS: How to pass index of row which is in section

I have a tableview structure like this, Section 1 ----> Row 1 ----> Row 2 ----> Row 3 Section 2 ----> Row 1 ----> Row 2 Section 3 ----> Row 1 ----> Row 2 ----> Row 3 ----> Row 4 How to get index of particular row that I have to pass, like i have…
iOSNoob
  • 1,420
  • 2
  • 16
  • 30
-2
votes
1 answer

The Application crashes at replaceobjectatindex

The application crashes at replaceobjectatindex . The clickedbuttonpath.row returns nil value . Need help . - (void)textFieldDidEndEditing:(UITextField *)textField { if (textField.text.length>0) { UITableViewCell *clickedCell = (UITableViewCell…
-2
votes
2 answers

Accessing CollectionView indexPath.row in prepareForSegue

I'm trying to access the indexPath.row variable from my collectionView in my prepareForSegue function. I have the following code: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { let selectedIndex =…
Ben
  • 1
  • 1
-2
votes
2 answers

Indexpath stored in array behaves differently

I m trying to store selected indexpaths for some purpose. Below code I m executing in cellForRowAtIndexpath: if ([_arrOfIndexPaths containsObject:indexPath]) { [filterCell setAccessoryType:UITableViewCellAccessoryCheckmark]; …
Rajesh
  • 10,318
  • 16
  • 44
  • 64
-2
votes
2 answers

My for loop doesn´t work well

This is the loop for: I would like that add 3 images (called 1.jpg, 2.jpg, 3.jpg) to 3 rows that the table has. But with >= the view doesn´t appeared and with == only the first row has an image. for (int i = 0; i >= indexPath.row; i++) { …
user1911
  • 680
  • 1
  • 14
  • 36
-3
votes
1 answer

What's the difference in rows and sections in NSIndexPath in Swift?

I can't seem to see what exactly a section is. I know what a row is in UITableViewController, but what is a section. Is it a separate piece of information? I'm a beginner and couldn't find a clear answer anywhere else on the web.
-3
votes
2 answers

why does my prepareForSegue Crash

I am trying to pass in IndexPath through a segue though a navigationController, but it crashes on line: view.selectedAccount = self.selectedAccountRow; thanks -(IBAction)changeButtonPressed:(id)sender { CGPoint buttonPosition = [sender…
James Walker
  • 69
  • 1
  • 8
-5
votes
1 answer

why my NSIndexPath value is not [0,1] but [0,64],how could I get [0,1]?

why my NSIndexPath value is not [0,1] but [0,64], how could I get [0,1]?
side3
  • 21
  • 4
1 2 3
33
34