iosxcodestoryboardseguedisclosure

How I can use the Detail Disclosure Button whith Storyboard?


I try to use the Detail Disclosure Button with the Storyboard, but when I build a segue from Disclosure Button to a new View it works only, when I press the table cell and not, when I press the Detail Disclosure Button.

What must I do?

Thanks,

Bernhard


Solution

  • I may be wrong but I have found that it needs to be implemented through UITableDelegate code:

    #pragma mark - Table view delegate methods
    
    - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
    {
        // do a segue based on the indexPath or do any setup later in prepareForSegue
        [self performSegueWithIdentifier:@"segueName" sender:self];
    }
    

    And then in your prepareForSegue

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
    
        if([segue.identifier isEqualToString:@"segueName"]){
    
            NSIndexPath * indexPath =  self.sequenceTableView.indexPathForSelectedRow;
           // do some prep based on indexPath, if needed
    
         }
    }