BrainLikeADullPencil
BrainLikeADullPencil

Reputation: 11663

table view cell not selectable

I created a segue from the table view cell (in a master view controller) to a view controller and gave the segue the name "ShowDetail". In prepareForSegue in the master view controller, I setup this code, however if I touch the table view cell in the master list, nothing happens, not even the first log statement gets triggered. when I right click the table view cell in the master view controller, it shows that there's a segue wired up. enter image description here

Is there a method that needs to be implemented in the master view controller to make the cell response to a touch? or is there another explanation why this might be happening?

-prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    NSLog(@"prepare for segue");
if ([[segue identifier] isEqualToString:@"ShowDetail"]){
        NSLog(@"in segue to display edit");

        DisplayEditViewController *devc = (DisplayEditViewController *)[segue destinationViewController];
        //        devc.delegate = self;
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        Event *selectedJoke = (Event *)[self.fetchedResultsController objectAtIndexPath:indexPath];
        devc.currentJoke = selectedJoke;
        devc.mood = selectedJoke.mood;
        devc.delegate = self;
        devc.mnemonicField = selectedJoke.mnemonic;
        devc.jokeField = selectedJoke.joke;


    }

Update 2

here's a compressed version of the project. As you see, my project lets me add new entries but not display them in the DisplayEditViewController https://dl.dropboxusercontent.com/u/10328969/preppyspeech.zip

Update 3

Even when I implement didSelectRowAtIndexPath in the masterviewcontroller, it (didSelectRowAtIndexPath) is not getting called when I click on the cell. See updated project here https://dl.dropboxusercontent.com/u/10328969/preppyspeech2.zip

Upvotes: 0

Views: 779

Answers (1)

iphonic
iphonic

Reputation: 12719

I have seen you Project, there is simple mistake, the Selection type for UITableView in MasterViewController is set to No Selection, so didSelect method for UITableView doesn't work, change it from image below

enter image description here

And it works.

Cheers.

Upvotes: 6

Related Questions