How to display datepicker like that in iOS 7 calendar UIDatePicker - ios

I'm new to iOS development, learning bits and pieces.
I've few more queries in continuation to another thread (iOS7: How does Apple make a navigation controller look like a uiactionsheet in the calendar app) on iOS 7 new event creation in default calendar that's shown when we click + on UINavigationBar (I assume).
Does anyone know how to create UIDatePicker so that its displayed/hidden when I click on Start/End date field? I saw one video where UIActionSheet was used in XCode 4.5, but in that user needs to click on Done etc button to hide it. In iOS 7 calendar its hidden when I click outside picker i.e. on Start Date field. I hope question is clear?
Kindly advise how to achieve this feature?

You can try and use the OCCalendarController, Its so simple and comfortable. Just download the zipped file and get all the files named after the prefix OC.
Of which in OCCalendarViewController.m you can make the necessary changes by adding Okay or Cancel buttons programmatically, yourself.
To call the calendar view in your main file use the lines,
//Here's where the magic happens
calVC = [[OCCalendarViewController alloc] initAtPoint:CGPointMake(150, 50) inView:self.view]; calVC.delegate = self; [self.view addSubview:calVC.view];
Also do include the following delegate to receive the date selection(if the user selects a date or date range)
- (void)completedWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate {
Finally you can also customize the arrow(which appears along with the calendar view) by using the code,
[OCCalendarViewController alloc] initAtPoint:insertPoint inView:self.view arrowPosition:OCArrowPositionRight]
Rest of the details can be found on the read me file. Try out yourself, It'll work like a charm.Cheers!

My open source project HSUDatePicker may help you.
https://github.com/tuoxie007/HSUDatePicker

Related

UIDatepicker display future years with ' ---'

iOS UIDatepicker shows '---' for future years. How to achive this in iOS. It will show only till current year and after that it shows '---'. I seen this when we adding any contact in our iPhone contact app, where there is field to addBirth. You can see that.
Please see screen shot.
The UIDatePicker doesn't have option for this.
Available Picker modes: time, date, dateAndTime, countDownTimer.
You can set maximumDate value, so that date after that can't be selected using UIDatePicker.
If you need to fulfil the exact need, you have to create custom UIPickerView with multiple component and Manage all things. NB: This could be messy.

How To Show full Calendar picker in iOS [duplicate]

I'm new to iOS development, learning bits and pieces.
I've few more queries in continuation to another thread (iOS7: How does Apple make a navigation controller look like a uiactionsheet in the calendar app) on iOS 7 new event creation in default calendar that's shown when we click + on UINavigationBar (I assume).
Does anyone know how to create UIDatePicker so that its displayed/hidden when I click on Start/End date field? I saw one video where UIActionSheet was used in XCode 4.5, but in that user needs to click on Done etc button to hide it. In iOS 7 calendar its hidden when I click outside picker i.e. on Start Date field. I hope question is clear?
Kindly advise how to achieve this feature?
You can try and use the OCCalendarController, Its so simple and comfortable. Just download the zipped file and get all the files named after the prefix OC.
Of which in OCCalendarViewController.m you can make the necessary changes by adding Okay or Cancel buttons programmatically, yourself.
To call the calendar view in your main file use the lines,
//Here's where the magic happens
calVC = [[OCCalendarViewController alloc] initAtPoint:CGPointMake(150, 50) inView:self.view]; calVC.delegate = self; [self.view addSubview:calVC.view];
Also do include the following delegate to receive the date selection(if the user selects a date or date range)
- (void)completedWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate {
Finally you can also customize the arrow(which appears along with the calendar view) by using the code,
[OCCalendarViewController alloc] initAtPoint:insertPoint inView:self.view arrowPosition:OCArrowPositionRight]
Rest of the details can be found on the read me file. Try out yourself, It'll work like a charm.Cheers!
My open source project HSUDatePicker may help you.
https://github.com/tuoxie007/HSUDatePicker

When will gestures to select specific values from DatePickers and ValuePickers become possible with the new UI Testing framework in iOS 9?

Right now, I am able to set accessibility labels and identifiers for different picker wheels in my application so that the recorder can pick up when I tap these picker wheels, and I am able to swipe up and down to modify the values, but I am unsure if there is a way for me to specify an exact value to select in these pickers. I am currently running XCode 7 Beta 5 and here is the following code I currently have:
//Expands the cell with the DatePicker
XCUIApplication().tables.staticTexts["Due Date"].tap()
//Modifies the Month, Day, and Year picker wheels.
XCUIApplication().tables.cells["dueDate"].pickerWheels["August"].swipeUp()
XCUIApplication().tables.cells["dueDate"].pickerWheels["19"].swipeUp()
XCUIApplication().tables.cells["dueDate"].pickerWheels["2015"].swipeUp()
As I mentioned, this code works fine, but I kind of have to guess at what the end result would be based upon the current start date (which is the current date, in our app) instead of being able to set the date to a known value.
Has anybody else been running into this same issue? If so, are there any known work arounds? It seems like the set of gestures that the API can mimic are still fairly limited.
Per this post starting in Beta 6 you should be able to do something like this...
app.datePickers.pickerWheels["2015"].adjustToPickerWheelValue("2005")

iOS error message tooltip

I need to show error message as a tooltip in iOS 8 but i don't know how to do it. What I want is something similar to the one shown in below image (I'm referring to the tooltip with messages Select and Select All):
There is a great collection of libraries which already target your problem.
For example have a look at: AMPopTip.
Then you could show the popover like:
self.popTip = [AMPopTip popTip];
[self.popTip showText:errorMessage direction:AMPopTipDirectionUp maxWidth:200 inView:self.view fromFrame:textField.frame];
and hide it:
[self.popTip hide];
Have a look at the github repo there are more examples for customizing this control.
You can find more which might suit your needs better here: cocoacontrols.com
I had a similar problem and wrote my own custom tooltip.
You can init with your custom view (i assume you write some delegations to detect actions within.) and present from anywhere.
Maybe not the best replacement of UIPopoverController but still works great. And a lifesaver for iPhone. Also highly customisable.
https://github.com/akeara/AKETooltip
Hope this helps.

invert UIDatePicker colors in iOS 7

I want to start by saying that i would post this question on the Apple Dev Forums but because of the hacking attempt fiasco , or whatever that was, the forum has been offline for almost 2 weeks now and i need a solution for this as soon as possible.
In iOS 7 the UIDatePicker looks like this :
and a client asked to look like this :
(basically inverted).
I've tried a few things:
Setting the background to black and looping through all the view's subviews until i reach the labels that show the date itself and change their color to white. The problem is that The view has only one subview, and that subview doesn't have any subviews of it's own. So this solution doesn't work. (it did in ios6).
Applying a filter to the view's CALayer. The thing is that this is only possible on OS X not on iOS, for some unknown reason.
Playing with UIApperance protocol. From what i've read this should work but what i've tried didn't and i don't have extensive experience with this to figure out why not.
Any ideas what i can try? Is this even possible? Did i made a mistake in my approach of the problem?
Try this out :
Put this code in -(void)viewDidLoad
[datePicker setValue:[UIColor whiteColor] forKey:#"textColor"];
Swift:
datePicker.setValue(UIColor.white, forKey: "textColor")
Don't know if this is still relevant but on Swift 3 / Xcode 8 you can simply do this:
let datePicker = UIDatePicker()
datePicker.datePickerMode = UIDatePickerMode.date
// Sets the text color
datePicker.setValue(UIColor.white, forKey: "textColor")
// Sets the bg color
datePicker.backgroundColor = UIColor.black.withAlphaComponent(0.6)
textField.inputView = datePicker
I spent quite a bit of time struggling with the same problem. At first, I've put a UIDatePicker on a black background and was wondering why it is invisible...
I ended up placing a white UIView as a background for the date picker, so while the whole view is black, the date picker is white. It actually looks okay, although thankfully I don't have a client who would dictate the design.
One possible argument for a client: the old, pre-iOS7 date picker, also had a predefined non-customisable background.
What you want is possible, but it will be called Custom Date Picker.
Below is the link where you will find what you wanted.
https://www.cocoacontrols.com/controls/simpledatepicker
If you need more, take a loot at below link.
https://www.cocoacontrols.com/search?utf8=%E2%9C%93&q=datepicker
Well I understand your frustration, but iOS7 is under NDA. Usually this kind of views are made using layers, beacuse of sublayerTransform that can make perspective giving the idea of 3D. I would check sublayers if you don't see subviews.
The other poin is that I would not hack too much views/layers hierachy, ios<=6 to ios7 transition shown that hacking isn't a good idea.
UIAppereance protocol is probably the way to go, becauase it makes you change what you can change (without screwing that in the future), maybe you can set a backgroundImage, try to set a 1x1pixel of a blck color png, you should also see an attributed string property, or text property.
I dont think its possible to do that directly by changing the properties of the default UIDatePicker , although you can use custom controls to do it.
This might help,
MWDatePicker - https://github.com/mwermuth/MWDatePicker (Found it in cocoa controls -https://www.cocoacontrols.com/controls/mwdatepicker)
according to the iOS Design Resources:
You cannot customize the appearance of date pickers.
I would suggest one of the below:
Redesign your UI to use the black text
Use a customer datepicker
You should tell your client that his suggestion is against the design principles of iOS 7, which indeed it is. I am not a great fan of iOS 7 myself, but we should all give it a go. Your client should accept the standard iOS 7 UI provisionally, until he is in a position to make an informed judgement. Designing an app based on his initial impressions is a recipe for disaster.

Resources