Php 在没有取消选择命令的情况下取消选择单元格

Php 在没有取消选择命令的情况下取消选择单元格,php,objective-c,noop,Php,Objective C,Noop,通常我典型的didselectrowatindexpath如下所示: -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath]; BGUIBusinessCellForDisplay * cellBiz = (BGUI

通常我典型的didselectrowatindexpath如下所示:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
    BGUIBusinessCellForDisplay * cellBiz = (BGUIBusinessCellForDisplay *) cell;
    [BGDetailBusinessViewController detailButtonPressed:cellBiz.biz withNavController:self.navigationController];
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
因此,如果选择了一行,请打开一个新窗口或其他内容。然后快速取消选择该行。不取消选择该行意味着当我们返回之前选择的行时,该行仍将存在

然而,如果我检查我过去的代码,我看到行被成功地取消选择,即使我根本没有调用取消选择

我在各处放置了一个陷阱,以跟踪取消选择行的位置和时间:

-(void)viewDidAppear:(BOOL)animated
{

...

PO(self.tableView.indexPathForSelectedRow); //always show null here
while(false);
}

通过ViewDidDisplay,比如说在我从detail返回后,self.tablevView.indexPathForSelectedRow已经为空。因此,行已被取消选择,但何时何地

我在明显的地方放了更多的陷阱

-(void)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    while (false);//breakpoint here never called
}

-(void) tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *) indexPath
{
    while (false); //breakpoint here never called 
}
这些都没有人打过电话

我放弃了

现在还不算大,但这让我困惑不已

这是完整的didSelectRowForIndexPath,因此您可以验证那里没有desellect命令

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];

    if ([cell isKindOfClass:[BGUIBusinessCellForDisplay class]])
    {
        BGUIBusinessCellForDisplay * cellBiz = (BGUIBusinessCellForDisplay *) cell;
        [BGDetailBusinessViewController detailButtonPressed:cellBiz.biz withNavController:self.navigationController];
    }
    else if ([cell isKindOfClass:[BGAddMoreBusiness class]])
    {
        BGBusinessEditViewController * editBusiness = [[BGBusinessEditViewController alloc]init];
        [self.navigationController SafelyPushController:editBusiness];
    }
    PO(self.tableView.indexPathForSelectedRow); //not null here
}

这是
UITableViewController
的默认行为,请参阅
clearselectiononviewwillappear
的文档:

此属性的默认值为
YES
。当
YES
时,表视图 控制器在收到命令时清除表的当前选择
视图将显示:
消息。将此属性设置为
NO
将保留 选择


这是
UITableViewController
的默认行为,请参阅
clearselectiononviewwillappear
的文档:

此属性的默认值为
YES
。当
YES
时,表视图 控制器在收到命令时清除表的当前选择
视图将显示:
消息。将此属性设置为
NO
将保留 选择


更新:按
查看将显示
行仍处于选中状态。通过查看显示,它不再显示。它们之间有
[表格重新加载]
。看起来像是取消选择该行。

更新:按
查看将显示
行仍处于选中状态。通过查看显示,它不再显示。它们之间有
[表格重新加载]
。看起来像是
[表格重新加载]
取消选择该行。

我正在使用带UIViewController的tableView而不是UITableViewController。我正在使用带UIViewController的tableView而不是UITableViewController。