I need to popup the Date Picker In my application when I click On the Text Field and I done It Nicely But Issue is After Selecting the Date Date picker Will goes away From Screen and when I click on Text Field it comes Back I know its simple Yet I need help thanks in advance.
Asked
Active
Viewed 592 times
0
-
what exactly you want with the date picker – Purva Mar 01 '12 at 07:19
-
first i want to get the date from date picker and after doing it datepicker will automaticallay goes away – Hardik rami Mar 01 '12 at 07:22
-
Put a tool bar exactly above the Date Picker and on that barbutton of toolbar add [picker setHidden: YES] and show the toolbar when u are showing the Picker. – Purva Mar 01 '12 at 07:29
-
Mr rami check this url http://stackoverflow.com/questions/8440256/displaying-a-uidatepicker-inside-of-a-uipopover – Nag_iphone Mar 01 '12 at 07:39
-
@purva:- I done it and it works well but datepicker dont come back when I click on TextField again – Hardik rami Mar 01 '12 at 09:37
3 Answers
1
try this :- this is UITextField delgete
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
picker.hidden =YES; // if You want
}
-(BOOL) textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
picker.hidden =NO;// if You want
}

Deepesh
- 8,065
- 3
- 28
- 45
1
try
yourTextField.inputView = yourPicker;
yourPicker.delegate = self; //(you need to declare your class will implement <UIPickerViewDelegate>
and on
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
//change your yourTextField.text here

Lucas
- 6,675
- 3
- 25
- 43
0
try this:
BOOL availability ;
availability = NO;
put in method where you call method to display DatePicker
if(availability)
{
picker.hidden =YES;
availability=NO;
}
else
{
picker.hidden =NO;
availability=YES;
}

Hector
- 3,909
- 2
- 30
- 46