繁体   English   中英

在Xcode7的UITest中使用'-[XCUIElement swipeDown]'时如何设置滑动距离

[英]How can I set the swipe distance when using '-[XCUIElement swipeDown]' in UITest with Xcode7

XCUIElement.h类文件显示
- (void)scrollByDeltaX:(CGFloat)deltaX deltaY:(CGFloat)deltaY;
- (XCUICoordinate *)coordinateWithNormalizedOffset:(CGVector)normalizedOffset; 职能。 但是这些不能在iOS设备上使用。 XCUIElement.h提供了- (void)swipeDown来滑动- (void)swipeDown 由于没有足够的距离向下滑动,无法响应像MJRefresh一样的“上拉到刷新”框架。
那么,如何自定义位置或使用存在功能来编辑向下滑动距离?

您可以下拉至坐标API来执行“上拉到刷新”。

let firstCell = app.staticTexts["Cell One"]
let start = firstCell.coordinateWithNormalizedOffset(CGVectorMake(0, 0))
let finish = firstCell.coordinateWithNormalizedOffset(CGVectorMake(0, 6))
start.pressForDuration(0, thenDragToCoordinate: finish)

我在博客上收集更多信息以及一个工作示例应用程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM