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
0
votes
1 answer

IndexPath.row changes when using search issue?

I am trying to successfully implement a UISearchcontroller into my UITableview however I have the following issues, I pass data using the indexPath.row method to the next view controller and the indexPath.row changes when I search, secondly I am…
0
votes
2 answers

how to call didSelectRowAtIndexPath from another class

I am in situation where i need to call didSelectRowAtIndexPath from another calls for that i do like this i make object of that class and call viewdidload so my table view get initialised - (void)_hideTapped:(id)sender { LeftController *left =…
java
  • 239
  • 5
  • 20
0
votes
1 answer

How to send data to a detail vc from callOutAccessoryControlTapped: method

I'm using the didSelectRowAtIndexPath: to pass some data from a table vc to a detail vc using the code below that works fine. What I'm trying to do is to also send this data from a map callOutAccessoryControlTapped: method but I am unsure how to…
user2588945
  • 1,681
  • 6
  • 25
  • 38
0
votes
1 answer

Why do I get a "conflicting type" warning when I implement didSelectRowAtIndexPath:

I'm implementing the didSelectRowAtIndexPath: method in a tableviecontroller implementation. I get a "conflicting type" warning in my code. Everything seems to work, but the warning bugs me. The code in my implementation file is as follows. -…
Michael
  • 1,009
  • 1
  • 9
  • 12
0
votes
1 answer

Index path row returning as strange number causing crash

I have a global variable that im writing into from a table view, in the: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath i am setting the global eventID variable (which is an [NSNumber numberWithInt]) to…
SmokersCough
  • 967
  • 7
  • 22
0
votes
2 answers

StoryBoard segue not working?

I'm trying to change the text on the DetailedViewController but every time I click on the cell I get this error. Any help is greatly appreciated. * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no…
0
votes
1 answer

Why are my mutable arrays and table views behaving unexpectedly?

I'm building a sign-in app. It has two table views. One lists people who have visited before (existingNames), and one lists the current people signed in (names). At certain points in my code the only mutable array that does not crash the program…
0
votes
1 answer

Value not passed passed to secondviewcontroller when the segue is triggered using table view cells of the firstviewcontroller

Ok so what do I want to achieve: I have a table view controller and a normal view controller. In the table view controller there a bunch of values from an array. What I want: when the user selects a cell with the value of a particular array I want…
0
votes
2 answers

How to retrive data when app is quit in objective C

I have an the app when notification is fired i get a notification bar when the app is in background ,when i tap on that bar it navigates into tableview of the notification set . When i quit the app from background i am receiving notification but…
0
votes
3 answers

UiTextView in Custom UiTableViewCell does not responds to didSelectRowAtIndexPath

I have a UITextView on a custom UITableViewCell and when I click on the UITextView, it does not trigger the didSelectRowAtIndexPath, how do I change this behavior so that that delegate is called as intended? Ive tried putting the User enabled…
0
votes
5 answers

Populating UITextView with Specific Info when UITableView Row is Selected

I have a UITableView and another view. The other view has a UITextView that I want populated with different text depending on what row in the table view is selected. I know how to do it if I create different views for all of the different text…
raginggoat
  • 3,570
  • 10
  • 48
  • 108
0
votes
3 answers

How to get the values of selected cells of a UITableView in one string

i'm pretty sure this is really simple. But i can't get to make this work. I have a UITableView where i display dynamically a list of facebook friends, thanks to their FBID. Basically, i would like to return the FBIDs of the friends i selected, in…
user2339627
0
votes
2 answers

Can't Change Accessory Type From didSelectRowAtIndexPath?

Before I post the question itself, I need to state this is a jailbreak app. This is why I'm writing in "bizarre" folders in the filesystem. Let's continue. Here is my cellForRowAtIndexPath method: -(UITableViewCell *)tableView:(UITableView…
Andy Ibanez
  • 12,104
  • 9
  • 65
  • 100
0
votes
1 answer

I'm trying to add a tableviewcell from one table to a different table Xcode

I am developing an iphone app for a class project and am displaying a bunch of different products. I am trying to create a favorites page where users can add one of the products to their favorites page. The app is set up with a bunch of different…
0
votes
2 answers

Array goes empty in DidSelectRowAtIndexPath

I have in my coreDatabase an entity "Day". In a method I fetch the data from that entity and put it in a mutuableArray dayObjects. You can see the code over here. NSManagedObjectContext *context = [RKManagedObjectStore…
Steaphann
  • 2,797
  • 6
  • 50
  • 109