我正在编写测试,我想通过滑动删除tableViewCell来删除它,公开红色的“删除”编辑操作。我可以很好地滑动单元格,但是当我尝试使用tapAtPoint时,问题就出现了。
这是直接从GREYActions.h
* @param point The point that should be tapped. It must be in the coordinate system of the element and it's position is relative to the origin of the element, as in (element_width/2, element_height/2) will tap at the center of element.
我尝试使用元素的帧和边界宽度减去1分,然后沿着单元格走到一半,如下所示:
CGPointMake(element.frame.size.width - 1, element.frame.size.height / 2)
我还是打不到牢房的尽头。
如果我能进一步解释的话请告诉我。
发布于 2017-05-18 22:20:13
@gran_profaci,我接受了你的想法,走了另一条路。
以下是我学到的:
有一个名为UITableViewCellDeleteConfirmationView的类,这就是当您在单元格上滑动时所显示的内容。它可能是一个私有类,因为在使用
if ([subview class] == [UITableViewCellDeleteConfirmationView class])从技术上讲,就好像这个视图是离屏的,而滑动会使它出现在屏幕上。正因为如此,它实际上不在细胞的坐标系中,而是在x轴上。例如,如果屏幕的宽度以及tableView和tableViewCell的宽度为600,则确认视图的框架原点将类似于(600.5, ...)。
最后,我在单元格的宽度上增加了5个点,这是非常有效的。
CGPointMake(element.frame.size.width + 5, element.frame.size.height / 2)https://stackoverflow.com/questions/44057625
复制相似问题