05-16-2011, 11:45 PM
#1 (permalink )
Etched In
Join Date: May 2009
Location: Fremont, California
Posts: 245
UIDatepicker's blue "today" label not changing
Hey,
When the user might use an app w/ a date picker that shows date and time and then leave their device on overnight, the blue Today label in the date picker still stays on the previous day's date, not the new date.
Is there a way to clear the date picker and then send it a new date?
Code:
datepicker = nil; //I was thinking that this would reset the date picker settings
datePicker.date = [NSDate date];
^doesn't work, just sets the new time and date, but not the today label.
05-17-2011, 12:10 AM
#2 (permalink )
Beast Mode
Join Date: Dec 2008
Age: 21
Posts: 1,971
Code:
[datePicker setDate:[NSDate date] animated:NO];
Also,
Maybe try changing the datePickerMode to "reload" the data.
__________________
Haters gonna Hate
Likers gonna Like
Last edited by Bertrand21; 05-17-2011 at 12:13 AM .
05-17-2011, 12:27 AM
#3 (permalink )
Etched In
Join Date: May 2009
Location: Fremont, California
Posts: 245
Quote:
Originally Posted by
Bertrand21
Code:
[datePicker setDate:[NSDate date] animated:NO];
Also,
Maybe try changing the datePickerMode to "reload" the data.
setDate doesn't work, it just sets the date. How would I get it to reload?
05-17-2011, 12:32 AM
#4 (permalink )
Beast Mode
Join Date: Dec 2008
Age: 21
Posts: 1,971
Quote:
Originally Posted by
ansonl
setDate doesn't work, it just sets the date. How would I get it to reload?
Also,
Maybe try changing the
datePickerMode to "reload" the data.
__________________
Haters gonna Hate
Likers gonna Like
05-17-2011, 12:40 AM
#5 (permalink )
Etched In
Join Date: May 2009
Location: Fremont, California
Posts: 245
Hmm, doesn't seem to work, either. Still keeps the Today label on the previous date.
I guess removing the datepicker and recreating it would work, but another method would probably be much better.
05-17-2011, 12:43 AM
#6 (permalink )
Beast Mode
Join Date: Dec 2008
Age: 21
Posts: 1,971
Quote:
Originally Posted by
ansonl
Hmm, doesn't seem to work, either. Still keeps the Today label on the previous date.
I guess removing the datepicker and recreating it would work, but another method would probably be much better.
So if you change it like so:
Code:
yourDatepicker.datePickerMode = UIDatePickerModeCountDownTimer;//Some random mode...
yourDatepicker.datePickerMode = UIDatePickerModeDateAndTime;//The mode you want...
It doesn't change
__________________
Haters gonna Hate
Likers gonna Like
05-17-2011, 12:44 AM
#7 (permalink )
Etched In
Join Date: May 2009
Location: Fremont, California
Posts: 245
Quote:
Originally Posted by
Bertrand21
So if you change it like so:
Code:
yourDatepicker.datePickerMode = UIDatePickerModeCountDownTimer;//Some random mode...
yourDatepicker.datePickerMode = UIDatePickerModeDateAndTime;//The mode you want...
It doesn't change
Yes, I used setDatePickerMode, but same thing.
05-17-2011, 07:05 PM
#8 (permalink )
Etched In
Join Date: May 2009
Location: Fremont, California
Posts: 245
No ideas, anybody?
05-18-2011, 03:05 AM
#9 (permalink )
Nuisance Developer
Join Date: Jul 2009
Location: Italy
Posts: 4,691
__________________
05-18-2011, 11:01 PM
#10 (permalink )
Etched In
Join Date: May 2009
Location: Fremont, California
Posts: 245
I'm trying this
Code:
[datePicker reloadAllComponents];
but the app freezes and says
Code:
-[UIDatePicker reloadAllComponents]: unrecognized selector sent to instance
This should be the right way to use it, right?
05-19-2011, 12:31 AM
#11 (permalink )
Beast Mode
Join Date: Dec 2008
Age: 21
Posts: 1,971
Quote:
Originally Posted by
ansonl
I'm trying this
Code:
[datePicker reloadAllComponents];
but the app freezes and says
Code:
-[UIDatePicker reloadAllComponents]: unrecognized selector sent to instance
This should be the right way to use it, right?
That is because UIDatePicker does not inherit from UIPicker. So that Method is not available on the UIDatepicker.
Your just gonna have to rebuild it I guess.
__________________
Haters gonna Hate
Likers gonna Like
05-19-2011, 12:39 AM
#12 (permalink )
Just helping out.
Join Date: Feb 2011
Posts: 2,565
Try:
Code:
[datePicker reloadInputViews];
05-19-2011, 12:43 AM
#13 (permalink )
Etched In
Join Date: May 2009
Location: Fremont, California
Posts: 245
Quote:
Originally Posted by
Domele
Try:
Code:
[datePicker reloadInputViews];
I wish it worked, but it didn't seem to do anything. Have you tried it successfully before? Maybe I just didn't do something right...
05-19-2011, 02:25 AM
#14 (permalink )
Nuisance Developer
Join Date: Jul 2009
Location: Italy
Posts: 4,691
Quote:
Originally Posted by
Bertrand21
That is because UIDatePicker does not inherit from UIPicker. So that Method is not available on the UIDatepicker.
Your just gonna have to rebuild it I guess.
right......i haven't checked
So seem that he need to recreate it.....
__________________
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44