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

问题描述

我正在使用一个UITableViewController,它在点击时执行一个动作表,效果很好。我想将详细信息披露与segue联系起来。我从单元格到下一个表创建了一个segue,并添加了以下代码:

I'm using a UITableViewController that performs an action sheet upon click, which works great. I'd like to tie the Detail Disclosure to a segue. I created a segue from the cell to the next table, and added the following code:

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
    [self performSegueWithIdentifier:@"GroupToGroupMembers" sender:self];
}

点击详细信息披露时效果很好。

Works great when I tap the Detail Disclosure.

问题是,现在点击单元格会导致操作表和segue关闭,这是我所期望的。

Problem is, tapping on the cell now causes both the action sheet AND the segue to fire off, which I would expect.

任何人都认为如何从详细披露 中解雇出来?

Anyone figure out how to fire off a segue off of a detail disclosure only?

推荐答案

你可能有GroupToGroupMemberssegue连接到您的UITableViewCell。执行此操作时,将在选择单元格时自动执行segue。除了显示操作表的常规事件处理之外,还会发生这种情况。

You probably have the "GroupToGroupMembers" segue hooked up to your UITableViewCell. When you do this, the segue is automatically performed when the cell is selected. This happening in addition to your regular event handling which is showing the action sheet.

将您的segue挂钩到UITableViewController。这允许您定义segue,以便可以执行它以响应轻触的DetailDisclosure,同时防止在选择单元格时自动执行segue。

Hook your segue up to your UITableViewController instead. This allows you to define your segue so that it may be performed in response to the DetailDisclosure being tapped while, at the same time, preventing the segue from being automatically performed when a cell is selected.

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

08-12 04:00