【问题标题】:How to count Table Cells in UIAutomation IOS如何在 UIAutomation IOS 中计算表格单元格
【发布时间】:2014-02-05 05:37:28
【问题描述】:

如果单元格在 UITableView 中随机创建,如何通过 IOS 中的 Instruments 计算单元格总数。

【问题讨论】:

  • 我曾尝试计算,但计数不正确。我正在编写部分代码:\n var temp = application.mainWindow().collectionView()[0].cells()[0].tableViews()[0].cells()[0]; \n var x=0;\nfor(var i in temp){x = x +1 } \n UILogger.logMessage(x);

标签: xcode5 ios-ui-automation xcode-instruments


【解决方案1】:

为什么不使用UIAElementArray.length 属性?从注释中提供的代码来看,它应该是这样的:

var cellsCount = application
                    .mainWindow()
                    .collectionView()[0]
                    .cells()[0]
                    .tableViews()[0]
                    .cells()
                    .length;

UIALogger.logMessage(cellsCount);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多