本文介绍了我如何使用故事板的详细信息披露按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将 Detail Disclosure Button 与 Storyboard 一起使用,但是当我构建从 Disclosure Button 到新视图的 segue 时,它​​仅在我按下表格单元格时起作用,而不是在按下 Detail Disclosure 按钮时起作用.

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.

我该怎么办?

谢谢,

伯恩哈德

推荐答案

我可能错了但是我发现需要通过UITableDelegate代码来实现:

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];
}

然后在你的 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

     }
}

这篇关于我如何使用故事板的详细信息披露按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 14:25