0

I have a UITableViewController for searching and user can make a search by date , but I want to let it optional, my problem is that I don't know how to do to reset the UITableViewController after selecting a date, because the UIDatePicker will always let the user choose a new date but not resetting the choosen one here is some screen shots :

search view

as you can see be default the values are "Tous" which means "All" so the user can let it like that and all fields are optional

Date picker

and now when you choose the date cell , you are now obliged to choose a date and there is no way to reset the field as you can see

Date fields

now there is no way to make it the value of the date field to back to "All" , in the other fields since they are strings I just added "Tous" ("All") with the other choices so the user can back to it whenever he wants as you can see here :

String picker

I don't know how to add an option to the date picker , maybe adding a new button like "today" to reset the field , so you know the problem any one can help please ?

Alaeddine
  • 6,104
  • 3
  • 28
  • 45

1 Answers1

0

When you show Date picker for Date cell, add one extra button to the toolbar, which will dismiss date picker and set date cell value to "All".

Jeepston
  • 1,361
  • 7
  • 7
  • Thank you , you mean I add a button next to "today" , I thought about that , but I am using ActionSheetPicker and I am afraid that this option is not possible , if you know how please show me the way any way I will try https://github.com/TimCinel/ActionSheetPicker – Alaeddine Mar 21 '13 at 14:34
  • You will have to modify the code a bit to get this working. Create a subclass of ActionSheetDatePicker and override the customButtonPressed: method. – lostInTransit Mar 21 '13 at 14:40
  • I have added a custom button and I implemented the method to handel the action of pressing that button, but I didn't find how to dismiss the UIDatePicker , like when you press the cancel button , do you have any idea how to do that , thanks – Alaeddine Mar 21 '13 at 21:54
  • I ended up with changing the method "dismissPicker" to be public , I don't know if it's a bad hack ! – Alaeddine Mar 21 '13 at 22:19