2015-09-10 24 views

回答

3

如果设置正确设置自定义单元格的可访问性,然后重新排序应控制访问。我们假设该单元将其可访问性标签/标识符分别设置为“LondonStreet”和“BakerStreet”。

您可以通过点击并从一个重排序控制到下拖动重新排列的细胞。这些控件的辅助功能标识符是根据单元格的信息自动设置的。

let app = XCUIApplication() 
app.launch() 

let topButton = app.buttons["Reorder LondonStreet"] 
let bottomButton = app.buttons["Reorder BakerStreet"] 
bottomButton.pressForDuration(0.5, thenDragToElement: topButton) 

"Reorder "前缀由操作系统设置。尝试使用辅助功能检查器查看重新排序控件的值。

Using the Accessibility Inspector to access the reorder control

我添加了一个例子,我UI Testing Cheat Sheet一些working sample code如果您想尝试一下你的机器上。

+0

我究竟如何检查我的电池前缀?如何打开辅助功能检查器? –

+1

访问性检查是在机器上安装一个应用程序,位于'/应用/ Xcode.app /内容/ Applications'。这个工具可以显示你的单元格的前缀。 –

0

先启用Accessibility Inspector你必须去:

系统预置>安全&隐私

enter image description here

然后的Xcode>开放开发工具>辅助功能Inspecto [R

enter image description here

相关问题