【发布时间】:2012-09-06 08:20:06
【问题描述】:
我发现 UIAPickerWheel.selectValue() 无法做到这一点,知道吗?
【问题讨论】:
标签: ios iphone instruments ui-automation ios-ui-automation
我发现 UIAPickerWheel.selectValue() 无法做到这一点,知道吗?
【问题讨论】:
标签: ios iphone instruments ui-automation ios-ui-automation
你可以像这样在选择器中传递你的值:
Picker.wheels()[1].selectValue(Your_Value);
在wheels()[1] 中,[1] 是您的轮号。
【讨论】:
this.popupWindow().pickers()[0].wheels()[0].selectValue("Sep 12, Thu"); 失败并显示“selectValue 需要一个有效值”。运行 6.1 iPad 模拟器。请注意,这是关于在 UIAutomation 中操作日期选择器,而不是关于 Objective-C 应用程序 UI 代码。
我在带有日期月份和日期的选择器上使用 UIAPickerWheel selectValue 函数时遇到了困难,如下图的第一个(最左边,零索引)轮子所示。唯一对我有用但不是最佳的解决方案是在当前选定值的上方(下方)点击一些指定的次数。以下代码将点击所选值上方以减少日期daysAgo 次。
var datePicker = this.popupWindow().pickers()[0];
for (var i = 0; i < daysAgo; ++i) {
datePicker.wheels()[0].tapWithOptions({tapOffset:{x:0.81, y:0.30}});
this.target().delay(.4);
}
【讨论】: