Dav*_*man 2 xcode enumeration ios xctest swift
我了解如何查看表中的一个元素,但是简单地遍历所有元素(无论找到多少元素)以例如点击它们的正确方法是什么?
let indexFromTheQuery = tables.staticTexts.elementBoundByIndex(2)
好吧,我成功地弄清了简单的语法。我刚刚开始使用Swift,所以我花了很多时间思考这个答案。
此代码有效:
var elementLabels = [String]()
for i in 0..<tables.staticTexts.count {
elementLabels.append (tables.staticTexts.elementBoundByIndex(i).label)
}
print (elementLabels)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3368 次 |
| 最近记录: |