Remove the “Today” entry from UIDatePicker
When using a UIDatePicker in iOS SDK, there is always an entry “Today” at the current date.
That’s useful in most cases, but where I need it, it’s rather confusing.
Is there a way to:
a) disable the “today”-entry (use regular date instead), and have all entries look the same
or even better
b) disable the “today”-entry (use regular date instead), and color the next day in blue
Further more, the application is for private use only, it’s not going to get distributed on the AppStore, which means I could use private APIs (I still would rather avoid them) and I don’t need it to be backwards compatible. iOS 4 is fine.
- Modify UIDatePicker selection indicator tint color
- How to change the format of date in date picker
- XCode: Why is my event not being added to the calendar?
- How to check if date (from date picker) is between two other dates ? objective-c
- How to change UIDatePicker to a specific time (in code)
- How to show Calendar instead of using UIDatePicker in iPhone?
2 Solutions Collect From Internet About “Remove the “Today” entry from UIDatePicker”
I had a similar problem with the UIDatePicker not matching my requirements exactly (in my case I needed a datepicker without a year wheel). Having a look at the UIDatePicker reference, it doesn’t look like you can disable the today entry, so you might be forced to do what I did.
I used a UIPickerView and re-implemented the date selection functionality I needed with that. There are a few things you will need to do to implement your custom date picker:
- Implement a UIPickerViewDataSource to set up row titles, dimensions and row counts.
- Implement a UIPickerViewDelegate to handle events from your custom picker.
- Make sure you update your day wheel when the month wheel changes so you get appropriate days for each month. UIDatePicker does this pretty seamlessly. With limited time, I just reload the picker when the month changes so the day counts match up.
I know an answer has been accepted but there actually IS a way to do this if you are displaying Date AND time. Its a hack but it works. Just seed the picker with a year other than today’s year, and the “Today” will disappear and be replaced with the canonical date.
- converting dot syntax to bracket syntax on a struct
- AVPlayerViewController doesn't play local videos
- React Native Build Commands Failed: PhaseScriptExecution … (domain=NSPOSIXErrorDomain, code=2)
- How to launch an app inside an application
- Firebase and Google Signin giving duplicate symbols error
- Add GPX File to Xcode 6 Project
- What types of dates are these?
- Swift write/save/move a document file to iCloud drive
- Setting frame to Date picker in iOS7
- How to compress/resize image on iPhone OS SDK before uploading to a server?
- Reconnecting to disconnected peers
- Delphi XE4 iOS can't connect to PAServer
- Calling from inside a block?
- Non-fullscreen UINavigationController
- NSXMLParser chokes on ampersand &