I am new for developing the ios application, I have used SBPickerSelector in Cocapods framework for Selecting datePicker. whether If possible to set the MinumDate and MaximumDate???
Asked
Active
Viewed 676 times
0
-
where you downloaded the `SBDatePicker` can you show the apth – Anbu.Karthik Aug 17 '16 at 07:16
-
yes I have dowloaded using Cocapods.. http://cocoadocs.org/docsets/SBPickerSelector/1.0.9/index.html – vara Aug 17 '16 at 07:17
-
can you show your tried code – Anbu.Karthik Aug 17 '16 at 07:31
-
func ShowDatePicker() { let picker: SBPickerSelector = SBPickerSelector.picker() picker.delegate = self picker.pickerType = SBPickerSelectorType.Date //picker.doneButtonTitle = "Done" //picker.cancelButtonTitle = "Cancel" picker.onlyDayPicker = true; //picker.datePickerType = SBPickerSelectorDateType.Default picker.defaultDate = NSDate() let point: CGPoint = view.convertPoint(view.frame.origin, fromView: view.superview) var frame: CGRect = view.frame frame.origin = point picker.showPickerIpadFromRect(frame, inView: view) } – vara Aug 17 '16 at 07:38
2 Answers
2
Try;
let picker: SBPickerSelector = SBPickerSelector.picker()
//Minimum Date
picker.datePickerView.minimumDate = NSDate(); // A date
//Maximum Date
picker.datePickerView.maximumDate = NSDate(); // An other date ;
//or picker.setMaximumDateAllowed(NSDate())

Shoaib
- 2,286
- 1
- 19
- 27
0
I do not understand what do you get from using SBDatePicker
, it look like they simply wrap the original class UIDatePicker
.
The problem of using this kind of wrappers is that they don't always have the full feature set of the original class and you count on their developers to keep up with Apple changes (which they don't).
If you simply use UIDatePicker
you can set maximumDate
and minimumDate
, just like you asked.
Check out the UIDatePicker Class Reference
And here is an example of setting the minimum and maximum dates

Community
- 1
- 1

Matan Lachmish
- 1,235
- 12
- 17