cooperrs / rmdateselectionviewcontroller Goto Github PK
View Code? Open in Web Editor NEWThis is an iOS control for selecting a date using UIDatePicker in an UIAlertController like manner
License: MIT License
This is an iOS control for selecting a date using UIDatePicker in an UIAlertController like manner
License: MIT License
Thanks for your control. This is really helpful.
Now I am trying to implement this with Swift. I am not sure how do I use following property.
@Property (nonatomic, copy) void (^selectButtonAction)(RMDateSelectionViewController *controller, NSDate *date);
Thanks in advance.
platform :ios, '8.0'
pod "RMDateSelectionViewController", "~> 2.0.0"
Result:
[!] Unable to satisfy the following requirements:
RMDateSelectionViewController (~> 2.0.0)
required by Podfile
This component works perfectly on iPhones (iOS 7 and 8) and on iPad with iOS7.
But on iPad iOS8, the View with the DatePicker is not shown. Only the screen gets a little darker on the view below.
Here is the code I wrote :
RMDateSelectionViewController *dateSelectionVC = [RMDateSelectionViewController dateSelectionController];
dateSelectionVC.delegate = self;
[dateSelectionVC show];
Note : As I don't have an iPad under iOS 8 yet, I tested it within the simulator.
On an iPad this control should be in a popover style.
An example of this using your showFromViewController: method would be helpful for universal apps.
How can I add year column in this picker ?
Here's the stack trace, which occurs when I call
let dateSelectionController = RMDateSelectionViewController.dateSelectionController()
dateSelectionController.delegate = self
dateSelectionController.show()
Stack trace:
2014-08-05 09:39:42.372 BeMore[28158:162270] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs'
*** First throw call stack:
(
0 CoreFoundation 0x000000010275e3e5 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104271967 objc_exception_throw + 45
2 CoreFoundation 0x000000010275e31d +[NSException raise:format:] + 205
3 Foundation 0x0000000102d064b6 VerifyConstraintArguments + 222
4 Foundation 0x0000000102b7129e +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:] + 427
5 BeMore 0x00000001015c3dc0 +[RMDateSelectionViewController showDateSelectionViewController:fromViewController:] + 464
6 BeMore 0x00000001015ca977 -[RMDateSelectionViewController showFromViewController:] + 311
7 BeMore 0x00000001015ca7e1 -[RMDateSelectionViewController showWithSelectionHandler:andCancelHandler:] + 385
8 BeMore 0x00000001015ca645 -[RMDateSelectionViewController showWithSelectionHandler:] + 101
9 BeMore 0x00000001015ca5d5 -[RMDateSelectionViewController show] + 53
10 BeMore 0x00000001014ee511 _TFC6BeMore14NewSessionView22openStartDateSelectionfS0_FPSs9AnyObject_T_ + 2785
11 BeMore 0x00000001014ee592 _TToFC6BeMore14NewSessionView22openStartDateSelectionfS0_FPSs9AnyObject_T_ + 66
12 UIKit 0x0000000103394c26 _UIGestureRecognizerSendActions + 262
13 UIKit 0x00000001033938c9 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 532
14 UIKit 0x00000001033984e6 ___UIGestureRecognizerUpdate_block_invoke662 + 51
15 UIKit 0x00000001033983e2 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 254
16 UIKit 0x000000010338e45d _UIGestureRecognizerUpdate + 2796
17 UIKit 0x000000010302e596 -[UIWindow _sendGesturesForEvent:] + 1041
18 UIKit 0x000000010302f1c3 -[UIWindow sendEvent:] + 667
19 UIKit 0x0000000102ffc001 -[UIApplication sendEvent:] + 246
20 UIKit 0x000000010300909e _UIApplicationHandleEventFromQueueEvent + 17707
21 UIKit 0x0000000102fe4679 _UIApplicationHandleEventQueue + 1967
22 CoreFoundation 0x0000000102693ac1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
23 CoreFoundation 0x000000010268998d __CFRunLoopDoSources0 + 269
24 CoreFoundation 0x0000000102688fc4 __CFRunLoopRun + 868
25 CoreFoundation 0x00000001026889f6 CFRunLoopRunSpecific + 470
26 GraphicsServices 0x000000010668f9f0 GSEventRunModal + 161
27 UIKit 0x0000000102fe7990 UIApplicationMain + 1282
28 BeMore 0x000000010150c1de top_level_code + 78
29 BeMore 0x000000010150c21a main + 42
30 libdyld.dylib 0x00000001047ca145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Really nice control. I've embedded it into my custom UITableViewCell and have had several requests now for people asking how they can "clear" the date/time value in the cell.
Unlike a regular UITextField that provides that tiny 'x' icon to clear its field, my thought for your control was to put in a simple "Clear" button that would return an empty string, and thus erasing any value within the cell.
Thoughts?
Great project looking to implement with a project am working on!!
Would it be possible to support podfile for easy integration and update?
This might be Apple UIDatePicker issue as well.
While the picker is animating, if user tap on "Select", UI seems wait for a while to let datePicker settle down to the final value, but the return value will still show the original value.
Tried capturing value through UIControlEventValueChanged, seems it able to return the final value even if DateSelectionViewController is dismissed.
I'm not sure how it could be patched in the component itself since UIDatePicker doesn't expose much info about the UI. Maybe you have some better idea.
Hi,
How I can display a format like this: 'DD/MM/YYYY' and 'YYYY/MM/DD'?
To reproduce:
start demo project
rotate in landscape mode
press "Show date..."
If I rotate after showing the control - all works as expected.
If i set datePickerMode to UIDatePickerModeDate it gives me wrong outputs for April, May, June, July, August, September and October.
Here are the samples
March 1 2001 -> Successfully selected date: 2001-03-01 00:00:00 +0000 True
April 1 2001 -> Successfully selected date: 2001-03-31 23:00:00 +0000 False
May 1 2001 -> Successfully selected date: 2001-04-30 23:00:00 +0000 False
June 1 2001 -> Successfully selected date: 2001-05-31 23:00:00 +0000 False
July 1 2001 -> Successfully selected date: 2001-06-30 23:00:00 +0000 False
August 1 2001 -> Successfully selected date: 2001-07-31 23:00:00 +0000 False
September 1 2001 -> Successfully selected date: 2001-08-31 23:00:00 +0000 False
October 1 2001 -> Successfully selected date: 2001-09-30 23:00:00 +0000 False
November 1 2001 -> Successfully selected date: 2001-11-01 00:00:00 +0000 True
How can we solve? I tried some adding timezone or changing time interval property but it does not work.
Parser stops says: Unknown type name 'UIBlurEffectStyle'
UIBlurEffectStyle is only available on iOS 8 and later, but I am still on 7
Cannot find interface NSDate in RMSelectedDate.m error
How to change the UIdatapicker's text color? That is the date time color, it is black by default. I want red, is it possible?
When I put my phone in landscape orientation and then show
the date selector, it shows up in the middle of the view and it's cut-off, only showing a portion of the selector.
It works fine if I show
the selector in portrait and then turn the device to landscape, but not if I show the selector from in landscape mode.
I think that the dateSelectionViewControllerDidCancel:
delegate method should be an optional method.
For many use cases, the cancel button should do nothing but dismiss the date selector, which is done by default, so I'm being required to implement a method with no functionality.
I'd be happy to make the changes and submit a pull request if you would like?
Otherwise, this is a great library. Thanks so much!
Following a Pod update I get the error "Cannot find protocol declaration for RMDateSelectionViewControllerDelegate" on the following interface:
@interface HHCreateTaskViewController () <UITextViewDelegate, RMDateSelectionViewControllerDelegate>
When I cmd-click RMDateSelectionViewControllerDelegate I get "Symbol not found". The library is imported in the controller with the following line:
And the Podfile:
platform :ios, '8.0'
pod 'RMDateSelectionViewController'
I tried cleaning the project folder, restarting Xcode etc.
When you call [dateSelectionVC show]
in a modal view controller the date selection view controller is shown behind it.
For iOS 7 support, I'm using 1.4.3 as advised in docs.
Its working well when i switch to landscape from portrait but unable to adjust frame when i open it in landscape.
let dateSelectionViewController = RMDateSelectionViewController.dateSelectionController()
dateSelectionViewController.show()
will work perfectly inside an app, but will not show the controller inside an app extension.
the view has a button whose target is linked to 'openDateSelectionController',view contronller has realized Delegates of RMDAteSelectionViewController .Then i touch the button,the method of 'openDateSelectionController' is being carried out,but datapicker does not display on the view!
The common way to make this works is to check for a macro APP_EXTENSION=1
defined in extension targets and encapsulate sharedApplication calls in this condition.
I notice that all the call are for either status bar or orientation, which are pretty useless in app extensions (Apple messed up on this).
Potentially helpful:
http://stackoverflow.com/questions/25462091/get-device-current-orientation-app-extension
http://stackoverflow.com/questions/25179411/how-to-know-current-interfaceorientation-in-extension-of-ios-8
Hi,
Is there any way to hide status bar? My app doesn't show status bar, but when I will show date selector, this appears and breaks design.
Thanks!
RMDateSelectionViewController relies on UIWindow for presentation. But an App Extension cannot present new UIWindows. Thus, RMDateSelectionViewController is incompatible with App Extensions. This should be fixed...
How can I use this as the inputView of a textfield that is in my custom tableview cell?
If you start in portrait mode and then rotate it on landscape, when you click to open the controller, it shows with the portrait frame size.
I got this exception when using swift :
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs'
I would like to a button which has "Don't select an End Date", I have this as a full width button in an action sheet at the moment, but I need to upgrade, is there anyway I can add a full width button.
I thought I could re-use the now button and move it underneath the picker, but I can't :(
Any thoughts ?
Hi,
I'm experiencing a crash with the following exception:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </../appname.app> (loaded)' with name 'RMDateSelectionViewController''
I'm using a pod file with the line:
pod "RMDateSelectionViewController", "~> 1.0.0"
Not sure what's going on yet, but I can see RMDateSelectionViewController.xib exists.
Hi. im trying to use this library in swift, however i get this error:
NSAssert(self.contentView != nil, @"Error: The view of an RMActionController has been loaded before a contentView has been set. You have to set the contentView before presenting a RMActionController.");
Any ideas?
let selectAction = RMAction(title: AppearanceService.textById(Texts.Ok), style: RMActionStyle.Done, andHandler: { (actionController) -> Void in
})
let cancelAction = RMAction(title: AppearanceService.textById(Texts.Cancel), style: RMActionStyle.Done, andHandler: { (actionController) -> Void in
})
let dateSelectionController = RMActionController(style: RMActionControllerStyle.White, selectAction: selectAction, andCancelAction: cancelAction)
presentViewController(dateSelectionController, animated: true, completion: nil)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.