Questions tagged [didselectrowatindexpath]

iOS - didSelectRowAtIndexPath: is a UITableView delegate method which is called when the user selects a row on a table view. Navigation logic goes here.

– tableView:didDeselectRowAtIndexPath:

iOS Method within UITableView (Apple Docs)

Full method decleration:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

Overview

didSelectRowAtIIndexPath: is a method part of the delegate. The UITableView delegate handle setup and events for a UITableView.

This method is called when a user selects a row in the table view, and takes an argument of NSIndexPath. The NSIndexPath contains the row, and section of the cell which was selected. Within this method, actions are performed to react to a user's selection.

Unlike this method, willSelectRowAtIndexPath: is used to allow or disallow a selection based on the index path.

Similar methods include:

– tableView:willSelectRowAtIndexPath:
– tableView:willDeselectRowAtIndexPath:
- tableView:didDeselectRowAtIndexPath:

Sample Code

An implementation of this method designed to handle navigation logic might look like this:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *) {
    NSUInteger row = [indexPath row]; // Easier to cache row, esp. in long methods

    // In viewDidLoad you would have set up an array of controllers, then:
    UIViewController *childController = [controllerArray objectAtIndex:row];
    [self.navigationController pushViewController:childController];
}
629 questions
-1
votes
1 answer

I'm stumped. NSLog verifies the object is what it's supposed to be, but adding the object to array isn't working

jeoData is a singleton...the table displays just fine, NSLog verifies the correct row is selected, however, jeoData.crewList.count returns zero after adding the object to the NSMutableArray... in the jeoData singleton, employeeList is initialized…
-1
votes
2 answers

Detail view not updating when UITableView rows are re-ordered

I have a UITableView that pushes to a Detail ViewController. In my tableview, my rows are draggable/re-arrangeable. However, when the rows are switched, the path stays the same when selecting the rows and the Detail View is presented. Example:…
-2
votes
1 answer

Passing objects using didSelectRowAtIndexPath:

How do I pass between objects from uitableviews to my detail views? I've set up a conditional push, as you can see in my method: -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { Budget * tempBudget =…
lorenzoid
  • 1,812
  • 10
  • 33
  • 51
-2
votes
1 answer

pushViewController or presentModalViewController to present something in the same screen

I have an iPad app that pulls info from an RSS feed, but instead of pushing to present information in the next screen, I want to still show it in the same screen (see image) When I use pushViewController NOTHING happens. When I use…
-2
votes
4 answers

UITableView row count in didSelectRowatIndexPath

how can i get UITableView row count in didSelectRowatIndexPath.can any one tell me a good way to get it
Vipin
  • 4,718
  • 12
  • 54
  • 81
-2
votes
1 answer

didSelectCellAtIndexPath not called

I know there are a lot of relevant post on this and I have tried all of the ones I can find and unfortunately the problem still persists. So I have a tableView inside of an UIViewController which is populated by 2 custom cells, one has got an…
-2
votes
1 answer

Save each didSelectRowAtIndexPath click's object in MutableArray

I have a list of items/cells in TableView. Table is set to allow multiple selection. So, i have these methods to select and deselect. @interface NotificationsViewController : UIViewController
Umit Kaya
  • 5,771
  • 3
  • 38
  • 52
-2
votes
2 answers

How to use didSelectRowAtIndexPath to navigate to a specific tableview controller? (Swift)

I know I need to use didSelectRowAtIndexPath, but despite searching I can't seem to find a simple explanation. I wish to use a TableView as an index for 10 other ViewControllers, but am having problems finding a simple resource that explains how to…
Benjamxm
  • 49
  • 9
-2
votes
2 answers

Push New View Controller From Subview

I have a UITableViewController as a subview of my UIViewController. The table view is populated from an RSS feed and that works fine. I'm trying to push a webviewcontroller onto my main navigation stack when a row in the subview is selected but I'm…
raginggoat
  • 3,570
  • 10
  • 48
  • 108
-2
votes
1 answer

Wrong indexPath for didSelectRowAtIndex

I parse an product ID via JSON which is then pushed to a detail view and put into an url to parse more information about the selected product but it seems like didSelectRowAtIndexPath returns a wrong indexPath because every time I hit a row it…
Constantin Jacob
  • 357
  • 1
  • 3
  • 12
-2
votes
1 answer

Long array with didSelectRowAtIndexPath Issue

I have an array which has lots of data which is dispalyed on the TableView. I am trying to push the selected row name. So every time I have to write IF method, while every row has the same method. Is there a way to just push the selected row? Thanks…
Luai Kalkatawi
  • 1,492
  • 5
  • 25
  • 51
-3
votes
1 answer

Cannot assign value of type 'String' to type 'MyOrderTableViewCell'

I would like to click the row based on ID, So i've declare an array to store the IDs: var idenArr = [String]() On the didSelectRowAt indexPath: func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { var cell =…
Nur II
  • 173
  • 1
  • 2
  • 16
-4
votes
1 answer

how to create same design like swiggy app payments screen in swift 4?

I have already tried with UITableview expand collapse but does not got effect like Swiggy payments wallet design screen. We need to create same design wallet design like Swiggy food delivery app in objective-c.
-4
votes
3 answers

Multiple json in didSelectRowAtIndexPath

I have maultiple json : http://privatereisen.com/dok/TV/pays/italie/json/chaine0.json http://privatereisen.com/dok/TV/pays/italie/json/chaine1.json...... etc And a table with different channels. Chaine0 is for the first row from UITableView. How…
Georgiana
  • 127
  • 3
  • 11
1 2 3
41
42