views:

49

answers:

1

Hi, I have picker view with only one component, and 5 values in the component.

I could get the number of wheels , and values in the component, as below

var picker = window.pickers(); 

UIALogger.logMessage("picker array count: " + picker.length);

var pickerWheels = picker[0].wheels();
var pickerWheelsValues =pickerWheels[0].values();

When i log the statement, like "pickerWheels[0].values()[1]", It does displays the first item.

The issue is, how to tap on it ?

pickerWheels[0].values()[1].tap(); // DOESN'T WORK

Can some one provide some input, how to tap on the picker wheel elements ?

I have tried also implementing the UIPickerViewAccessibilityDelegate and overridden //Set the accessiblity for each component.

- (NSString *)pickerView:(UIPickerView *)thePickerView accessibilityLabelForComponent:(NSInteger)component{
    thePickerView.isAccessibleElement = YES;
    thePickerView.accessibilityLabel= @"label";
    return @"label";
}
A: 

There is a post on O'Reilly that shows one way to interact with pickers (scroll down to the reply posted by 'zpthacker').

Basically it involves calculation of where to tap on the picker to have it go back or forth.

The sample needs to be tweaked a bit in order to work regarding creation of a Point, for instance to the following

var tapLoc = new Object();
tapLoc.x = origin.x+tapWidth;
tapLoc.y = tapHeight+origin.y;
target.tap(tapLoc);
Claus Broch
Hi, Earlier I have tried that but, it fails with the below error message.Exception raised while running script: ReferenceError: Can't find variable: Point var tapLocation = new Point(origin.x+tapWidth, tapHeight+origin.y); <----- Am i missing something ? pls help
Senthil
Yes, I noticed that too. I have modified my answer, so the point should be created properly (but as an Object)
Claus Broch
Thanks a lot Claus, It works. !!
Senthil