locking - iOS Datepicker: How to LOCK invalid dates? -


i've been struggling maximum/minimum date lately, , honestly, don't know i'm missing here. searched lot , no 1 seems complain it. (i'm not talking setting maximum/minimum date these can make invalid dates appear gray)

here's i've done far:

    [mydatepicker addtarget:self action:@selector(disabledate) forcontrolevents:uicontroleventvaluechanged]; 

then, on disabledate, have this:

if ([mydatepicker.date compare:[nsdate date]] == nsordereddescending) {         mydatepicker.date = [nsdate date];     } 

(or ascending, depends on dates want disable)

the thing is: works fine once. in other words: open view , try pick, example, 2007, scrolls 2013. great. right after that, if try scroll invalid date (including 2007), won't scroll anymore until reopen view. feel i'm missing simple here, don't know what.

thanks lot in advance!

ps: mention, i've put inside disabledate

    nslog(@"value changed"); 

just make sure it's calling method everytime scroll datepicker, , yes, working;

ps2: i've tried same using

- (ibaction)datepickervaluechanged:(id) sender 

instead , had same behaviour.

so in order "reset" uidatepicker can use reloadinputviews method (since uidatepicker subclass of uiresponder

edit: spelling


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -