【问题标题】:Is it possible to call the TouchesBegan, touchesMoved and touchesEnded in SubView, and not in parentView?是否可以在 SubView 中而不是在 parentView 中调用 TouchesBegan、touchesMoved 和 touchesEnded?
【发布时间】:2016-03-21 19:57:43
【问题描述】:

我的问题是 touchesBegan、touchesMoved 和 touchesEnded 的焦点是:

- (void)didSelectWithTableView:(UITableView *)tableView controller:(UIViewController *)controller
{
...
}

在表格视图中单击。所以 didSelectWithTableView 永远不会被调用...

是否可以有一个由 touchesBegan、touchesMoved 和 touchesEnded 处理的子视图(在弹出窗口中),而不是父视图?

【问题讨论】:

    标签: ios objective-c uitableview uipopovercontroller


    【解决方案1】:

    只需调用方法的超级实现。连同您的覆盖代码。

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        [super touchesBegan:touches withEvent:event];
        ...
    }
    
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
        [super touchesMoved:touches withEvent:event];
        ...
    }
    
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        [super touchesEnded:touches withEvent:event];
        ...
    }
    

    【讨论】:

    • 谢谢老兄,这就是重点。现在我的下一个问题是,如果你能帮助我,那张票...stackoverflow.com/questions/36135820/…我尝试在作为弹出框的子视图中使用这三种方法(touchebegan、moved 和end)...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多