Does anyone have a basic example to display a UIPickerView when a UITextField was selected.
A:
The best place to do so would be in the NSTextField Delegate method:
- (BOOL)textShouldBeginEditing:(NSText *)textObject
Override the method to return NO and instead evoke the picker view. Returning NO will prevent the keyboard from appearing.
TechZen
2010-04-14 00:53:19
A:
What I did was implement touchesEnded event. If that event occurs in my UITextField parameters then I either hide or show the UIPickerView
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
if (CGRectContainsPoint([self.textField frame], [touch locationInView:self.view]))
{
//Want to show or hide UIPickerView
if(pickerView)
{
submitButton.hidden = !submitButton.hidden;
pickerView.hidden = !pickerView.hidden;
}
}
}
aahrens
2010-04-14 04:26:25