Hiding/ Showing UIPickerView
Posted
by aahrens
on Stack Overflow
See other posts from Stack Overflow
or by aahrens
Published on 2010-04-14T01:04:30Z
Indexed on
2010/04/14
1:13 UTC
Read the original article
Hit count: 749
iphone
|uipickerview
I Have an a touchesEnded event that checks for when a UITextField is pressed. What I would like it to do is is hide/show a UIPickerView. How can this be done?
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [[event allTouches] anyObject];
if (CGRectContainsPoint([self.textField frame], [touch locationInView:self.view]))
{
NSString * error = @"Touched the TextField";
UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Selection!" message:error delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];
//Want to show or hide UIPickerView
}
}
I already have an allocated UIPickerView when touches occur
@interface ThirdViewController : UIViewController <UITextFieldDelegate,UIPickerViewDelegate> {
IBOutlet UIPickerView *pickerView;
}
© Stack Overflow or respective owner