Project: titanium
Issue TIMOB-19488: iOS9: 3D-Touch: Support UIPreviewActions ("Peek and Pop")
Apple just presented the new 3DTouch feature of the iPhone6S. User can press a view and will review an instant feedback providing a preview of a view to select different actions, called {{UIPreviewAction}}. Each action have a {{title}}, {{style}} and {{handler}} property. Multiple actions can also be assigned to {{UIPreviewActionGroup}}. That group can have have a {{title}}, {{style}} and {{actions}} property to keep track of the assigned actions. *Related documents:* - https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIPreviewAction_Class/ - https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIPreviewActionGroup_Class/ *Example:* {code} var sendAction = Ti.UI.iOS.createPreviewAction({	title : "Send per Mail",	style : Ti.UI.iOS.PREVIEW_ACTION_STYLE_DEFAULT }); sendAction.addEventListener("click", function() {	alert("send mail!"); }); var confirmAction = Ti.UI.iOS.createPreviewAction({	title : "Confirm",	style : Ti.UI.iOS.PREVIEW_ACTION_STYLE_DESTRUCTIVE }); var cancelAction = Ti.UI.iOS.createPreviewAction({	title : "Cancel" }); var deleteAction = Ti.UI.iOS.createPreviewActionGroup({	title : "Delete",	actions : [confirmAction, cancelAction],	style : Ti.UI.iOS.PREVIEW_ACTION_STYLE_DESTRUCTIVE }); confirmAction.addEventListener("click", function() {	alert("delete!"); }); var win = Ti.UI.createWindow({	backgroundColor : "white" }); // The view to be previewed while popping. var previewView = Ti.UI.createView({	backgroundColor : "blue" }); previewView.add(Ti.UI.createLabel({	color : "#fff",	text : "Preview!" })); // The window to be opened after popping the preview. var detailWindow = Ti.UI.createWindow({	backgroundColor : "yellow" }); detailWindow.add(Ti.UI.createLabel({	text : "You made it!" })); // Create the preview context var context = Ti.UI.iOS.createPreviewContext({	preview : previewView,	actions : [sendAction, deleteAction], // Can have both Ti.UI.iOS.PreviewAction + Ti.UI.iOS.PreviewActionGroup	contentHeight : 100, // When unspecified, we use the available height	pop : function(e) {// Called after popping the preview	detailWindow.open();	} }); // Assign the preview context var trigger = Ti.UI.createButton({	title: "Peek here!",	backgroundColor : "#000",	tintColor: "#fff",	width : 200,	height : 50,	previewContext : context }); win.add(trigger); win.open(); {code}
Story points: 13