ios绘图

The PencilKit framework was introduced by Apple in iOS 13. It gives developers the ability to easily add writing and drawing capabilities to their own apps via the Apple Pencil or touch. It’s the same low latency framework used by Apple across their apps (such as Notes).

PencilKit框架是Apple在iOS 13中引入的。它使开发人员能够通过Apple Pencil或touch轻松向自己的应用程序添加书写和绘图功能。 这与Apple在其应用程序(例如Notes)中使用的低延迟框架相同。

PencilKit makes it easy to incorporate hand-drawn content into your iPadOS or macOS apps. PencilKit provides a drawing environment for your iOS app that receives input from Apple Pencil or the user’s finger, and turns it into images you display in iPadOS, iOS, or macOS. The environment comes with tools for creating, erasing, and selecting lines. — PencilKit, Apple Developer

PencilKit使将手绘内容轻松整合到iPadOS或macOS应用程序中变得容易。 PencilKit为您的iOS应用程序提供了一个绘图环境,该环境可以接收来自Apple Pencil或用户手指的输入,并将其转换为您在iPadOS,iOS或macOS中显示的图像。 该环境附带了用于创建,擦除和选择线条的工具。 — Apple Developer PencilKit

You just need three lines of code to start off

您只需要三行代码即可开始

The PKCanvasView handles all information being added to your app through Apple Pencil and touch via the tool specified. All this information and data is stored in a PKDrawing object, which you can save and load within your app, or export to an image. You can either setup your own tools or use Apple’s native PKToolPicker.

PKCanvasView处理通过Apple Pencil添加到您的应用中的所有信息,并通过指定的工具进行触摸。 所有这些信息和数据都存储在PKDrawing对象中,您可以在应用程序中保存和加载该对象,或者将其导出到图像。 您可以设置自己的工具,也可以使用Apple本地的PKToolPicker 。

Drawing on the canvas is seamless, and is a very enjoyable user experience.

在画布上绘画是无缝的,并且是非常愉快的用户体验。

On to a simple example: a cute drawing app aimed at creative kids.

举一个简单的例子:针对创意孩子的可爱绘图应用程序。

Create a new project in Xcode 12, select the App template and Storyboard for the interface. Set the Device Orientation to be Landscape Left in the project’s target General tab.

在Xcode 12中创建一个新项目,选择App模板和Storyboard作为界面。 在项目的目标“常规”选项卡中,将“设备方向”设置为“横向向左”。

We will use an Asset Catalog to manage the colors. Add a new file to your project, scroll to the Resources section and select Asset Catalog. Name it Colors.

我们将使用资产目录来管理颜色。 将新文件添加到您的项目,滚动到“资源”部分,然后选择“资产目录”。 命名为颜色。

Select Asset Catalog
选择资产目录

At the bottom of the Color Asset Catalog click on the add sign and select Color Set.

在“颜色资产目录”的底部,单击加号,然后选择“颜色集”。

Two empty color sets will be created. These are to manage the colors for light and dark mode in your apps. However, since we are creating an app aimed at drawing we will not need to manage the colors in this way (unless you want to

ios绘图_使用Pencilkit轻松将绘图功能添加到ios应用相关推荐

  1. python七巧板绘图_记录一次canvas绘图(七巧板)

    效果图如上 代码如下: canvas .canvas_box{ border:1px solid #ddd; display: block; margin: 0 auto; } var tangram ...

  2. 安卓手机运行ios教程_英雄联盟手游傻瓜安装教程,IOS/安卓双端可用!

    软件/资料获取方式在文末 正文: 前几天发哥预告了一下LOL手游上线的事,本来以为国服也会同步上线,结果也是意料之中的跳票了,让我不禁想起当年玩魔兽世界时国服万年的TBC,不过据说LOL推迟上线是怕影 ...

  3. flutter ios打包_使用 Travis CI 为 Flutter 项目打包 Android/iOS 应用

    Travis CI 构建 Building Flutter APKs and IPAs on Travis 这篇文章详细介绍了如何在 Travis CI 上为 Flutter 项目打包 Android ...

  4. EasyClick iOS脚本_免越狱_免硬件_iOS脱机版开放接口使用说明

    说明 很多时候我们使用usb版本可能达不到或者不满足我们的需求,所以我们可以配合EasyClick iOS脚本的脱机版,一起完成我们的需求. 专门用于和别的程序做交互的开放接口 例如usb版本无法完成 ...

  5. B4i(iOS)应用程序所需的所有功能

    B4i(iOS)应用程序所需的所有功能 B4i(iOS)包括开发本地iOS应用程序所需的所有功能.编译的应用程序是本机iOS应用程序,没有额外的运行时或任何依赖项.B4i遵循与B4A相同的概念,允许您 ...

  6. 一组功能丰富的iOS组件:YYKit

    YYKit 是一组庞大.功能丰富的 iOS 组件. 为了尽量复用代码,这个项目中的某些组件之间有比较强的依赖关系.为了方便其他开发者使用,我从中拆分出以下独立组件: -YYModel - 高性能的 i ...

  7. iOS开发UI篇—Quartz2D使用(绘图路径)

    iOS开发UI篇-Quartz2D使用(绘图路径) 一.绘图路径 A.简单说明 在画线的时候,方法的内部默认创建一个path.它把路径都放到了path里面去. 1.创建路径  cgmutablepat ...

  8. IOS绘制小黄人,对绘图知识的一个练习

    IOS绘制小黄人,对绘图知识的一个练习 #define kTopX rect.size.width * 0.5 #define kTopRadius 80 #define kTopY 260// // ...

  9. python turtle 绘图_谈一下Pycharm中关联系统Python解释器的方法

    大家知道,PyCharm是一款著名的Python IDE开发工具,是拥有一整套可以帮助用户在使用Python语言开发时提高其效率的工具,具备基本的调试.语法高亮.Project管理.代码跳转.智能提示 ...

最新文章

  1. WebGame 客户端 美术资源处理之PNG批量导出SWF
  2. Android Studio导入Fresco
  3. gsl eclipse
  4. 《象与骑象人》总结一
  5. 大数据WEB阶段(八)Tomcat服务器安装与详解、HTTP协议详解
  6. 页式存储管理程序模拟_ADAS/AD开发12 - 数据存储管理
  7. 错误 找不到或无法加载主类
  8. 使用Jenkins,GitHub和Docker的最先进的持续集成和部署管道
  9. 当当购书双十一钜惠,5折封顶!附图灵人工智能书单
  10. asp.net夜话之十一:web.config详解
  11. 视频编码格式全面解析
  12. 【自动化】Python脚本selenium库完成自动创建汇联易账号
  13. 【基础知识】【模块介绍】8位8段数码管(74HC595)【硬件部分】
  14. 内容播放colorbox
  15. 让样本不一样重要-A Dual Weighting Label Assignment Scheme for Object Detection
  16. openlayers实现地图显示功能
  17. Nikto v2.1.0-手册
  18. ADS3 Inverted File Index
  19. VMware 安装 Linux 系统
  20. 房贷利率有无套路?Python解读“等额本金与等额本息”的差异所在

热门文章

  1. 电脑上打开chm文件时系统提示:不能打开文件:mk:@MSITStore:(文件路径)
  2. 微信小程序开发语言(微信小程序开发教程)详细步骤
  3. 干货来袭!腾讯T4大佬,十分钟教你用svg做出精美的动画
  4. 2021年塔式起重机司机复审考试及塔式起重机司机考试试题
  5. 模拟器和平精英连接服务器没有响应,和平精英模拟器卡顿解决方法一览
  6. 为什么主机IP地址通常以192.168开头?
  7. 用 JavaScript 实现手势库 — 手势动画应用【前端组件化】
  8. (有小案例)初始Mybatis框架及使用
  9. c语言转职,救世之树R和C的意义新手详解 职业和技能的转职
  10. Android图形shape的gradient渐变色背景