I am using UIDatePicker in my iPhone application.I have kept a button on clicking which the mode of datepicker switches between UIDatePickerModeTime and UIDatePickerModeDate.
When I change the date of datepicker when the mode is UIDatePickerModeDate,the changed date correctly appears when I switch the mode but if I change the time and switch the mode,on again switching the mode to UIDatePickerModeTime resets the time to 12:00 AM.I am not getting why this is happening and what to do for it.Please help.
I am using UIDatePicker in my iPhone application.I have kept a button on clicking
Share
I used a Date object which I declared as a property in which I stored the date from the date picker when I present the date picker.
I updated the stored date when I changes the date in date picker(Using UIControl Notification)
On changing the mode of the date picker I assigned the same date to the date picker.
I understand this was fairly simple but formerly I was trying the same thing by taking a simple Date object which didn’t work.Making it a property did the job for me