【问题标题】:How to disable touch row in uitable without disable highlight如何在不禁用突出显示的情况下禁用合适的触摸行
【发布时间】:2014-03-12 16:28:20
【问题描述】:

在 UITable 中,我获取所选行的索引。当我获得行索引时,我想禁用她,然后它不能被按下,但突出显示应该保留。当我点击另一行时,它是高亮的,前一行是启用的,高亮是禁用的。

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    CellIndex = indexPath.row;
    [self.containerViewController swapViewControllers:CellIndex];
}

如果您单击已按下的行,我希望什么都不会发生。 谢谢大家的帮助。

【问题讨论】:

    标签: ios ipad uitableview


    【解决方案1】:

    保留一个知道最后按下哪一行的变量,并签入tableView:didSelectRowAtIndexPath:

    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        if(previouslySelectedIndexPath == indexPath)
            return;
        previouslySelectedIndexPath = indexPath;
    
        CellIndex = indexPath.row;
        [self.containerViewController swapViewControllers:CellIndex];
    }
    

    【讨论】:

    • 非常感谢,对您有帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-31
    • 1970-01-01
    • 2017-09-06
    • 2015-05-04
    • 2023-03-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多