Use the native iOS 13+ PencilKit framework in Axway Titanium. This module is sponsored by binaries included!
- Titanium SDK 8.2.0+
- iOS 13+
- Xcode 11+
import PencilKit from 'ti.pencilkit';
const win = Ti.UI.createWindow({
title: 'Current canvas'
});
const nav = Ti.UI.createNavigationWindow({
window: win
});
win.addEventListener('open', () => {
canvasView.focus();
});
const saveButton = Ti.UI.createButton({
title: 'Save'
});
saveButton.addEventListener('click', saveCanvas);
win.rightNavButton = saveButton;
const canvasView = PencilKit.createCanvasView();
win.add(canvasView);
nav.open();
function saveCanvas() {
canvasView.generateImage({
callback: event => {
const win2 = Ti.UI.createWindow({
title: 'Saved canvas',
backgroundColor: '#fff'
});
const nav2 = Ti.UI.createNavigationWindow({
window: win2
});
win2.add(Ti.UI.createImageView({
image: event.image
}));
nav2.open({
modal: true
});
}
});
}
Hans Knöchel
MIT
(c) 2019-present by binaries included