Skip to main content
Participating Frequently
April 10, 2013
Question

Trigger the native IOS datePicker?

  • April 10, 2013
  • 4 replies
  • 3264 views

Hello guys, does anyone know if it's possible to trigger the IOS Native Date Picker from Adobe Air?

thanks so much for any info!

This topic has been closed for replies.

4 replies

marchbold
Inspiring
July 8, 2014

A native extension is the only way I know of doing this at the moment

Our Dialog ANE, has date time pickers if your interested in a well supported extension: http://distriqt.com/product/air-native-extensions/dialog

air native extensions // https://airnativeextensions.com
User Unknow
Legend
February 13, 2014

You can develop or request payed help from that who know how to do Native Extension. DatePicker it's not most hard thing that can be coded in Native Extension.

User Unknow
Legend
February 13, 2014

Google it. I just heared that DatePicker already exist on some github and ready to use as Native Extension. So it will be Native to iOS.

Lars Laborious
Legend
April 11, 2013

This might not be the answer you hoped for, but you could make your own datepicker look like iPhone's native one. I've done this ones, using Greensocks ThrowPropsPlugin to flick movieclips that contained days, month and year. Combining it with Flash's Date class.

Santanu Karar
Known Participant
February 13, 2014

Hey Las, do you mind share a sample code doing custom Date Picker? Maybe somewhere in GitHub?

Thanks!

Lars Laborious
Legend
February 13, 2014

Unfortunately this was a while ago, on a project I no longer have immediate access to. And it was made looking like the IOS 6 date picker where the wheel didn't have any "real" curve, so the text didn't need to skew at the top or bottom (it only had shadows from the outer frame).

Now with IOS 7, the dates that disappear at the visual edges sort of shrink and curve a bit, making it more tricky. I agree with Anton Azarov that Native Extention would probably be the easiest way if you want it to look "IOS 7"-ish.

However, if you don't really need the text distortion at the wheel edges, you could do as I and generate x number of dates, and adding them to three movieclips, making three columns. For instance the first column would consist of a textfield created this way:   

var days:Array = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];

var months:Array = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];

var date:Date;

var tf:TextField = new TextField();

tf.width = 200;

tf.height = 400;

myColumnMc.addChild(tf);

for(var i:int = 0; i<60; i++){

  date = new Date();

  date.setDate((date.date - 30) + i);

  tf.appendText(days[date.getDay()] + " " + months[date.getMonth()] + " " + date.getDate() + "\n");

}

This way I had dates before and after current date. Then I made them draggable with easing and velocity when released, using the ThrowPropsPlugin (this is a paid plugin, but you could of course write your own).

Chris W. Griffith
Community Expert
Community Expert
April 10, 2013

Unfortunately AIR does not expose access to any of the native controls. Their might be an ANE that would expose it, but I have not seen one. The lack of access to default widgets has always been one of the weak points of AIR. It is fully capable if you have a 100% custom UI, but if you need to use 'native' widgets you are out of luck.

Chris