Comments (4)
Please look again at the demo project, there's sample code there. If you want to be notified when picker is dismissed, use this:
picker.dismissHandler = {
picker.removeFromSuperview()
}
For donePicking
, do this:
picker.completionHandler = { date in
let formatter = DateFormatter()
formatter.dateFormat = "hh:mm aa dd/MM/YYYY"
self.title = formatter.string(from: date)
}
If you just want to be notified for selected dates, make sure to set delegate of the picker:
picker.delegate = self
And implement the delegate function:
func dateTimePicker(_ picker: DateTimePicker, didSelectDate: Date) {
title = picker.selectedDateString
}
from datetimepicker.
Hi, in order to get callback for Done and Cancel button, please make sure that you implement dismissHandler
and completionHandler
.
from datetimepicker.
Still don't quite understand. I don't get why dismissView() and donePicking() just aren't called. The buttons have touch gestures to trigger these functions? After adding picker, I only expected to have to code logic for "send date selected here". I have no way to reference the cancel and done buttons, calling dismissHandler does nothing.
from datetimepicker.
Got it working now. I completely missed the demo project, hence the confusion. Thank you!
from datetimepicker.
Related Issues (20)
- Haptic Feedback HOT 1
- Show method / Modal not working HOT 3
- MinuteInterval add case sixty HOT 1
- Time Label miscue HOT 27
- Date is not showing at all HOT 2
- How can I disable automatic selection? HOT 3
- How to start cells from starting instead of loading from center HOT 1
- Update Minimum Date after creating Date Picker HOT 1
- Fatal error: Unable to find bundle named DateTimePicker
- Shared Unavailable
- Set background for DateTimePicker in light, dark mode iOS 13. HOT 1
- Support for Dark Mode HOT 1
- Scroll the table view to an out-of-bounds row HOT 1
- Cannot set time...
- Default selected time is clipped (24H Format) HOT 4
- Fail to Load Nib HOT 1
- isdateinweekend not working as expected HOT 1
- Compile Warning "Leading or Trailing horizontal alignment before iOS 11.0 [5]"
- SwiftUI Errors: Won't scroll, defaults to today's time HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datetimepicker.