ios - Maxdate not updating after app went in background for a couple days -


i making app datepicker , maxdate work once meaning if app goes in background couple of days maxdate not updating. there method tell app regain focus check maxdate. thx in advance :)

when application comes background, delegate method viewwillappear not called. rather should below thing.

at time of reactivation, if want carry particular thing viewcontroller, should register notification in viewdidlaod method.

'uiapplicationdidbecomeactivenotification' automatically notify application , given controller, if have registered for. so,add below code in viewdidload method.

 [[nsnotificationcenter defaultcenter]addobserver:self                                          selector:@selector(setmaxdate)                                              name:uiapplicationdidbecomeactivenotification                                            object:nil]; 

now write down method,

-(void) setmaxdate {     myselecteddate.maximumdate = [nsdate date]; } 

do not forget remove observer in dealloc method.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -