Skip to main content
Participating Frequently
Apr 10, 2013 4:47 PM UTC
Question

Trigger the native IOS datePicker?

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 is closed to new replies. Start a new post to keep the conversation going.

7 replies

marchbold
Inspiring
Jul 8, 2014 12:12 AM UTC

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

Translate
air native extensions // https://airnativeextensions.com
User Unknow
Legend
Feb 13, 2014 7:30 AM UTC

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.

Translate
User Unknow
Legend
Feb 13, 2014 9:16 AM UTC

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.

Translate
Lars Laborious
Legend
Apr 11, 2013 8:34 AM UTC

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.

Translate
Santanu Karar
Known Participant
Feb 13, 2014 6:39 AM UTC

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

Thanks!

Translate
Lars Laborious
Legend
Feb 13, 2014 9:15 AM UTC

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).

Translate
Chris W. Griffith
Community Expert
Community Expert
Apr 10, 2013 6:44 PM UTC

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

Translate