如何导出 .drawing 文件

问题描述

我正在尝试使用 Pencilkit 在应用程序中绘制一些东西。现在我想从我的文件中导出我的图纸,这样我就可以打开将它发送到其他设备,然后打开它(格式为 PKDrawing)。

解决方法

...

type GrabTypesAndConvertOne<T,U,TypeToConvert> = {
    [K in keyof T as K extends K
        ? T[K] extends U
            ? K
            : T[K] extends TypeToConvert
            ? K // <- Here is where the type change logic would live
            : never
        : never]: T[K];
};

type GrabbedTypes = GrabTypesAndConvertOne<A,string,PromiseFunc>

<?php namespace Genealogy; use \PDO; use \Exception; use \ArrayAccess; use \Countable; use \Iterator; class Record implements Iterator,ArrayAccess { ... function save($output) { ... foreach($this->row as $fld => $value) { switch($fld) { case 'added': { // date added $fldnames .= "$comma`$fld`"; $values .= "$comma:$fld"; $parms[$fld] = $today; $comma = ','; break; } // date added case 'addedtime': { // time added $fldnames .= "$comma`$fld`"; $values .= "$comma:$fld"; $parms[$fld] = $currtime; $comma = ','; break; } // time added case 'updated': { // date updated $fldnames .= "$comma`$fld`"; $values .= "$comma:$fld"; $parms[$fld] = $today; $comma = ','; break; } // date updated case 'updatedtime': { // time updated $fldnames .= "$comma`$fld`"; $values .= "$comma:$fld"; $parms[$fld] = $currtime; $comma = ','; break; } // time updated case 'soundslike': { $fldnames .= "$comma`$fld`"; $values .= $comma . "LEFT(SOUNDEX(`Surname`),4)" . $comma = ','; break; } default: { if (substr($fld,-7) == 'soundex') { // soundex updated $fldnames .= "$comma`$fld`"; $srcfld = substr($fld,strlen($fld)-7); $values .= $comma . "LEFT(SOUNDEX(:$srcfld),4)"; $comma = ','; } // soundex updated else if (is_string($prime) && $fld == $prime && $srvmg) { // let SQL server manage field value } // let SQL server manage field value else { // other fields $fldnames .= "$comma`$fld`"; $values .= "$comma:$fld"; $parms[$fld] = $value; $comma = ','; } // other fields // if I put return 0; here the function returns but the database is not updated break; } // default } // switch } // loop through all fields in record // if I put return 0 here The ZEND engine crashes before getting to the return $insert = "INSERT INTO $table ($fldnames) " . "VALUES($values)"; $stmt = $connection->prepare($insert); $insertText = debugPrepQuery($insert,$parms); $this->lastSqlCmd = $insertText; if ($stmt->execute($parms)) 的类型为 var canvasView = PKCanvasView() //user does drawing... let data = canvasView.drawing.dataRepresentation() 。然后,您可以将其写入文件 (https://developer.apple.com/documentation/foundation/nsdata/1414800-write) 并根据需要导出。

例如,您可以使用 ExportFilesAction:https://www.youtube.com/watch?v=iDseNgvdTpA

要将这些数据加载回 data,您可以:

Data