Hi all,
I implemented a tab bar controller. One of the tab items takes user to a page where they can filter date ranges. When user selects in text field, rather than keyboard poppping up, a datepicker pops up and has a toolbar with a button item on it. When user clicks on button, the toolbar and datepicker are hidden. Problem is now when I try to select another tab bar item, it is no longer responsive.
Here's my code:
thanks for response
I implemented a tab bar controller. One of the tab items takes user to a page where they can filter date ranges. When user selects in text field, rather than keyboard poppping up, a datepicker pops up and has a toolbar with a button item on it. When user clicks on button, the toolbar and datepicker are hidden. Problem is now when I try to select another tab bar item, it is no longer responsive.
Here's my code:
Code:
- (void)viewDidLoad
{
[super viewDidLoad];
self.datePicker = [[UIDatePicker alloc]init];
[self.datePicker addTarget:self action:@selector(dateChanged:) forControlEvents:UIControlEventValueChanged];
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(addButtonPressed)];
[toolbar setItems:[NSArray arrayWithObject:doneButton]];
self.dateToolbar = toolbar;
self.historyDateSelect.inputView = self.datePicker;
self.historyDateSelect.inputAccessoryView = self.dateToolbar;
historyDateSelect.delegate=self;
}
- (void)addButtonPressed
{
self.dateToolbar.hidden=YES;
self.datePicker.hidden=YES;
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
self.dateToolbar.hidden=NO;
self.datePicker.hidden=NO;
return YES;
}
thanks for response