2015-09-10 29 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

相關問題