Core Animation学习笔记—第二节Setting up Layer Objects

Unity粒子系统5分钟实现Logo汇聚动画:零代码特效实战 粒子系统是游戏开发与交互设计中实现动态视觉特效的核心组件,它通过模拟大量微小粒子(如光点、烟雾、火花)的运动、生命周期和外观变化,来构建复杂的动态视觉效果。其工作原理基于模块化参数控制,开发者无需编写底层渲染代码,即可通过调整发射、形状、速度、颜色等模块,灵活设计出从自然现象到科幻场景的各类特效。在技术价值上,粒子系统极大地降低了动态视觉效果的制作门槛,提升了开发效率,是实现UI动效、场景过渡、技能表现和品牌展示的利器。常见的应用场景包括游戏技能特效、应用启动动画、数据可视化以及产品Logo的动态展示。本文 阅读详情

各位iOS开发大佬们好:
我是一名Swift+SwiftUI栈的iOS小白,目前还在上大三,最近准备实习,面试的过程中发现现在大公司很多还在用OC + UIKit的技术栈,OC我还在考虑要不要学,目前想先把UIKit学完,这是我在官网学习UIKit英文文档时摘录的本人认为的重点,如果你们也觉得对你们有用的话欢迎持续关注,我大概一天更一节,有事除外。格式什么的我也就不做了,翻译都是我自己翻译的,哪里不对欢迎在评论区指正,感谢各位大佬支持

今天2021年12月2日
这一章叫做Setting up Layer Objects

iOS默认自动启用layer,但在OS X中还是需要显式的启用它以获得更好的性能表现
Link against the QuartzCore framework. (iOS apps must link against this framework only if they use Core Animation interfaces explicitly.)
Enable layer support for one or more of your NSView objects by doing the following:
For views you create programmatically, call the view’s setWantsLayer: method and pass a value of YES to indicate that the view should use layers.
在OS X中需要做以下工作来显式启用Layer
与QuartzCore链接
调用setWantsLayer: 方法,传入一个YES来启用你NSView对象的layer

可以更换与视图关联的layer类型以获得更方便的操作和可能更好的性能

在iOS中可以通过重写视图的layerclass方法为视图返回一个其他类型的layer
以下三种情况是你可能会去更改layer类型的

Your view draws content using Metal or OpenGL ES, in which case you would use a CAMetalLayer or CAEAGLLayer object.
There is a specialized layer class that offers better performance.
You want to take advantage of some specialized Core Animation layer classes, such as particle emitters or replicators.
视图使用Metal或OpenGL ES绘图时,可能会需要CAMetalLayer或CAEAGLLayer对象
其他提供更高性能的layer类型
使用一些专用CALayer例如particle emitters 或者 replicators

通过重写NSView的makeBackingLayer方法来更改默认layer类,实现时创建并返回你需要的layer类型

A layer-hosting view is an NSView object for which you create and manage the underlying layer object yourself. You might use layer hosting in situations where you want to control the type of layer object associated with the view. For example, you might create a layer-hosting view so that you can assign a layer class other than the default CALayer class. You might also use it in situations where you want to use a single view to manage a hierarchy of standalone layers.

托管图层视图是一个NSView对象,你需要自己创建并管理底层layer对象,在你需要控制视图layer的类型时,或在您想使用单个视图来管理独立图层的层次结构的情况下可以使用它。

When you call the setLayer: method of your view and provide a layer object, AppKit takes a hands-off approach to that layer. Normally, AppKit updates a view’s layer object but in the layer-hosting situation it does not for most properties.
当调用视图的setLayer:方法并提供图层对象时,AppKit不会对layer进行操作。AppKit会更新视图的图层对象,但在图层托管的情况下,大多数属性不会更新视图的图层对象。

If you choose to host layers yourself, you must set the contentsScale property yourself and provide high-resolution content at appropriate times.
如果选择自己控制layer,你需要自己设置contentsScale 属性,并在任何时候提供高分辨率的内容
CALayer是所有layer的基类,以下是衍生layer

在这里插入图片描述

layer的content其实就是包含可视数据的位图
你可以通过以下三种方法之一为位图提供可视数据
Assign an image object directly to the layer object’s contents property. (This technique is best for layer content that never, or rarely, changes.)
Assign a delegate object to the layer and let the delegate draw the layer’s content. (This technique is best for layer content that might change periodically and can be provided by an external object, such as a view.)
Define a layer subclass and override one of its drawing methods to provide the layer contents yourself. (This technique is appropriate if you have to create a custom layer subclass anyway or if you want to change the fundamental drawing behavior of the layer.)
直接往contents属性里放一个image对象(一般用于几乎不再更改视图内容的情况)
做一个代理对象,让代理对象完成内容绘制(一般用于content可能由外部对象比如view构成并且会随时更改的情况)
定义一个layer子类,并重写其中一个drawing方法提供layer内容(一般用于需要动态改变content或改变layer的绘制行为的情况)

对于第一种方法:
layer会直接使用你提供的image对象而不会深拷贝以节省内存使用,你提供的image必须是CGImageRef(在OS X中为NSImage)类型,提供的image分辨率必须和屏幕分辨率相匹配,对于Retina displays,你需要调整视图的contentsScale 属性
对于第二种方法:
If your delegate implements the displayLayer: method, that implementation is responsible for creating a bitmap and assigning it to the layer’s contents property.
If your delegate implements the drawLayer:inContext: method, Core Animation creates a bitmap, creates a graphics context to draw into that bitmap, and then calls your delegate method to fill the bitmap. All your delegate method has to do is draw into the provided graphics context.
如果你两种都实现了的话那么layer只会调用displayLayer方法

A layer-backed view automatically makes itself the delegate of its layer and implements the needed delegate methods, and you should not change that configuration. Instead, you should implement your view’s drawRect: method to draw your content.
In OS X v10.8 and later, an alternative to drawing is to provide a bitmap by overriding the wantsUpdateLayer and updateLayer methods of your view. Overriding wantsUpdateLayer and returning YES causes the NSView class to follow an alternate rendering path. Instead of calling drawRect:, the view calls your updateLayer method, the implementation of which must assign a bitmap directly to the layer’s contents property. This is the one scenario where AppKit expects you to set the contents of a view’s layer object directly.
View自动代理它的layer并且实现必要的代理方法,你应该实现view的drawRect方法绘制内容而不是更改代理方法
对于OS X v10.8之后的系统版本,通过重写视图的wantsUpdateLayer 和 updateLayer 方法提供位图,重写wantsUpdateLayer 返回YES使NSView类按照新的渲染路径渲染内容,视图的updateLayer方法必须直接为图层的content属性分配位图
对于第三种方法:
不常用,一般用于自定义layer时,通过以下两种方法绘制layer内容
Override the layer’s display method and use it to set the contents property of the layer directly.
Override the layer’s drawInContext: method and use it to draw into the provided graphics context.
Which method you override depends on how much control you need over the drawing process. The display method is the main entry point for updating the layer’s contents, so overriding that method puts you in complete control of the process. Overriding the display method also means that you are responsible for creating the CGImageRef to be assigned to the contents property. If you just want to draw content (or have your layer manage the drawing operation), you can override the drawInContext: method instead and let the layer create the backing store for you.
以上两种方法中如果你想要控制更新视图内容的过程,用display,如果你仅想绘制内容,用drawInContext
contentsGravity属性匹配内容和layer的尺寸
The values you can assign to the contentsGravity property are divided into two categories:
The position-based gravity constants allow you to pin your image to a particular edge or corner of the layer’s bounds rectangle without scaling the image.
The scaling-based gravity constants allow you to stretch the image using one of several options, some of which preserve the aspect ratio and some of which do not
contentsGravity属性可赋值的两种类型,一种是基于位置的,一种是基于伸缩的
设置合适的contentsScale属性来适配不同分辨率的内容,默认值为1.0,如果是Retina Display的话设置2.0,只在直接将位图赋值给layer的情况下使用即可,其他情况都会自动设置

在这里插入图片描述
在这里插入图片描述

the position-based gravity constants affect the way image representations are chosen from an NSImage object assigned to the layer. Because these constants do not cause the image to be scaled, Core Animation relies on the contentsScale property to pick the image representation with the most appropriate pixel density
基于位置的contentsGravity参数会影响image的representation从layer的NSImage对象中选择的方式。因为这类基于位置的参数不会引起图像拉伸,Core Animation依赖contentsScale属性匹配最合适的像素密度来显示图像
the layer’s delegate can implement the layer:shouldInheritContentsScale:fromWindow: method and use it to respond to changes in the scale factor. AppKit automatically calls that method whenever the resolution for a given window changes, possibly because the window moved between a standard-resolution and high-resolution screens. Your implementation of this method should return YES if the delegate supports changing the resolution of the layer’s image. The method should then update the layer’s contents as needed to reflect the new resolution
layer的代理可以通过实现layer:shouldInheritContentsScale:fromWindow:方法对scale factor中的改变做出响应,APPKit每当屏幕分辨率改变时会自动调用该方法,通过返回YES来使代理支持改变layer中image的分辨率,之后更新为新分辨率内容
Layer有自己独立于内容的背景色,边框等一系列装饰属性,边框渲染在内容上方,背景色渲染在layer层上,关系如下
在这里插入图片描述

You can use any type of color for the background of a layer, including colors that have transparency or use a pattern image. When using pattern images, though, be aware that Core Graphics handles the rendering of the pattern image and does so using its standard coordinate system, which is different than the default coordinate system in iOS. As such, images rendered on iOS appear upside down by default unless you flip the coordinates.
背景色可以为任何颜色或指定的image,但image将由CG在其标准坐标下渲染,与iOS坐标系统相反,所以如果不翻转坐标系渲染结果将会颠倒
如果layer有圆角,那么禁止将其标记为不透明
Because it involves applying a transparency mask, the corner radius does not affect the image in the layer’s contents property unless the masksToBounds property is set to YES. However, the corner radius always affects how the layer’s background color and border are drawn.
Layer圆角不会影响其内容,可以通过设置masksToBounds属性为YES使内容同步圆角
使用阴影时offset注意当前环境坐标系统
在这里插入图片描述

When adding shadows to a layer, the shadow is part of the layer’s content but actually extends outside the layer’s bounds rectangle. As a result, if you enable the masksToBounds property for the layer, the shadow effect is clipped around the edges. If your layer contains any transparent content, this can cause an odd effect where the portion of the shadow directly under your layer is still visible but the part extending beyond your layer is not. If you want a shadow but also want to use bounds masking, you use two layers instead of one. Apply the mask to the layer containing your content and then embed that layer inside a second layer of the exact same size that has the shadow effect enabled.
阴影效果将会延伸到layer外,所以尽量不使用masksToBounds切割,如果必须使用,那么可以用两层layer,一层用来做阴影,一层用来使用masksToBounds

Filters Add Visual Effects to OS X Views
In OS X apps, you can apply Core Image filters directly to the contents of your layers. You might do this to blur or sharpen your layer’s contents, to change the colors, to distort the content, or to perform many other types of operations. For example, an image processing program might use these filters to modify an image nondestructively while a video editing program might use them to implement different types of video transition effects. And because the filters are applied to the layer’s content in hardware, rendering is fast and smooth.
Note: You cannot add filters to layer objects in iOS.
For a given layer, you can apply filters to both the foreground and background content of the layer. The foreground content consists of everything that the layer itself contains, including the image in its contents property, its background color, its border, and the content of its sublayers. The background content is the content that is directly under the layer but not actually part of the layer itself. The background content of most layers is the content of its immediate superlayer, which may be wholly or partially obscured by the layer. For example, you might apply a blur filter to the background content when you want the user to focus on the layer’s foreground content.
You specify filters by adding CIFilter objects to the following properties of your layer:
The filters property contains an array of filters that affect the layer’s foreground content only.
The backgroundFilters property contains an array of filters that affect the layer’s background content only.
The compositingFilter property defines how the layer’s foreground and background content are composited together.
To add a filter to a layer, you must first locate and create the CIFilter object and then configure it before adding it to your layer. The CIFilter class includes several class methods for locating the available Core Image filters, such as the filterWithName: method. Creating the filter is only the first step, though. Many filters have parameters that define how the filter modifies an image. For example, a box blur filter has an input radius parameter that affects the amount of blur that is applied. You should always provide values for these parameters as part of the filter configuration process. However, one common parameter that you do not need to specify is the input image, which is provided by the layer itself.
When adding filters to layers, it is best to configure the filter parameters prior to adding the filter to the layer. The main reason for doing so is that once added to the layer, you cannot modify the CIFilter object itself. However, you can use the layer’s setValue:forKeyPath: method to change filter values after the fact.
这部分我不知道怎么翻,filter是过滤的意思,但我觉得过滤器有点奇怪,我暂时把它翻成特效吧
特效只有OS X上有,iOS上没有
通过给layer的以下属性添加CIFilter对象来指定特效
filter属性包含了一个只对layer的foreground内容有效的filter数组
backgroundfilter属性包含了一个只对layer的background内容有效的filter数组
compositiongFilter属性定义了前后背景特效的组合方式
最好在Filter被添加进来之前进行配置,因为一旦filter被添加进来,不能直接修改CIFilter对象,但可以通过setValue:forKeyPath: 方法动态更改
OS X的重绘原则决定了性能
Each view defines a layerContentsRedrawPolicy method that returns the redraw policy for the view’s layer. You set the policy using the setLayerContentsRedrawPolicy: method. To preserve compatibility with its traditional drawing model, AppKit sets the redraw policy to NSViewLayerContentsRedrawDuringViewResize by default. However, you can change the policy to any of the values
每个视图都定义了一个 layerContentsRedrawPolicy 方法返回其layer的重绘原则,你可以通过setLayerContentsRedrawPolicy: 方法编写重绘原则,为了保持与其传统绘图模型的兼容性,AppKit默认将重绘策略设置为NSViewLayerContentsRedrawDuringViewResize。你可以调整为下表中的任一原则
在这里插入图片描述

第 25 章:View 系统与输入事件分发 LayoutInflater 运行时将 XML 布局资源转换成 View 对象,连接 res/layout 下声明式 XML 和内存中程序视图树。来源:frameworks/base/core/java/android/view/LayoutInflater.java (第 74 行)...创建自定义 View 需要理解并实现正确的回调方法。默认 onMeasure 实现 wrap_content 会填满父容器;自定义 View 需要正确处理测量模式。@Override// 固有尺寸像素。 阅读详情

相关推荐

Unity2D游戏开发入门:从零到一构建2D横版平台跳跃游戏

游戏开发的核心在于将创意转化为可交互的体验,而2D游戏因其相对简单的视觉表现和逻辑结构,成为许多开发者入门的首选。其基本原理是通过游戏引擎整合图形渲染、物理模拟、用户输入和逻辑脚本,构建出虚拟世界。在众多引擎中,Unity以其强大的功能、成熟的生态和“所见即所得”的编辑器工作流,显著降低了开发门槛,提供了极高的技术价值。它尤其适合快速原型验证和独立游戏开发,广泛应用于平台跳跃、解谜、RPG等多种2D游戏场景。本文聚焦于Unity2D,通过拆解一个完整的2D横版平台跳跃游戏项目,系统讲解从项目结构搭建、核心组

weixin_33794672的博客 385

layui 弹出层 [object Object] 的问题

解决方式如下: layer.open({ title: false, type:1, //重点在这里,设置type为1可以解决 [object Object] 的问题 closeBtn: 0, content: $('#id') });

面对疾风吧 3728

Unity 2D像素风横版游戏开发:从零搭建核心架构与实战避坑指南

在游戏开发领域,2D横版游戏因其直观的玩法和清晰的开发路径,成为许多独立开发者和初学者的首选。其核心原理在于通过精灵渲染、2D物理模拟和状态机逻辑,构建出丰富的交互世界。掌握2D游戏开发技术,不仅能实现复古像素风的艺术表达,更能为后续更复杂的游戏类型打下坚实基础。从玩家控制器的手感调优,到敌人AI的有限状态机设计,再到基于Tilemap的关卡高效搭建,每一个环节都直接影响最终的游戏体验和工程可维护性。本文聚焦于Unity引擎,深入探讨如何从零开始,构建一个高内聚、低耦合的2D游戏项目架构。通过引入Scrip

weixin_30608503的博客 306

SwiftUI Core Animation Framework 基础教程

Core Animation 渲染,合成和动画化视觉元素。 使用教程 核心动画提供了高帧率和流畅的动画,而不会给CPU造成负担,也不会降低了您的应用程序运行速度。 绘制动画的每一帧所需的大部分工作已为您完成。 您可以配置动画参数(例如起点和终点),其余部分由Core Animation完成,将大部分工作交给专用的图形硬件,以加快渲染速度。 有关更多详细信息,请参见《 Core Animation编...

iCloudEnd的博客 593

【数字孪生工业应用实战】第3篇:三维建模与几何孪生实战:从CAD到轻量化场景的完整流程(万字深度扩展版)

本文系统介绍了数字孪生项目中从CAD模型到轻量化三维场景的完整转换流程,重点解决工业模型中数据过重、格式兼容差、老旧设备模型缺失等难题。核心技术包括模型格式转换与减面优化(QEM算法)、LOD层级细节优化、点云处理与网格重建,每项均配有Python/Blender批处理脚本、参数调优经验及运行数据。文章特别新增材质PBR通道优化、Web端glTF压缩策略、工业点云采集对比方案,并给出一个从CAD到Three.js渲染的完整集成案例。作者结合多年实战,总结了十几个真实开发中的常见坑点和解决思路,帮助读者快速掌

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 266

别再踩坑了!Win10下用阿狸狗V3.2.6安装Cadence SPB 17.4的保姆级避坑指南

本文提供了Win10系统下使用阿狸狗V3.2.6安装Cadence SPB 17.4的详细避坑指南,涵盖环境准备、安装失败清理、分步安装与问题诊断、授权配置及典型故障排除等内容,帮助用户顺利完成安装并避免常见错误。

weixin_32576389的博客 361

JavaScript 对象 — 重学 JavaScript

这里我们继续学习两个比较重要的类型,就是 `Object` 和 `Symbol`。我们主要讲的是 Object,相对 Object 来说 Symbol 只是一个配角。

三钻 - 之前端到全栈之路 6764

SAP期初库存导入 (1)

LSMW

IT养家 7193

legend2---开发日志13(layer_mobile的content传入dom 出现【object object】如何解决)

legend2---开发日志13(layer_mobile的content传入dom 出现【object object】如何解决) 一、总结 一句话总结: layer_mobile.content只能为string类型 方法一:将dom转成字符串,比如$('$aa').html(),这样的缺点是丢失那些事件 方法二:外面套上script标签,并且把id加在script标签上,因为scri...

weixin_33805992的博客 559

Jetson nano/nx使用麒麟arm版向日葵实现远程控制

Jetson nano/nx使用麒麟arm版向日葵实现远程控制1、安装向日葵软件2、运行Sunlogin Client3、向日葵闪退问题4、重启系统5、重启后黑屏问题 特别提醒: 本博客的第3步切换桌面管理环境到lightdm,存在重启后开机黑屏的风险,我在自己的nano/nx上都没有问题,但帮一个同学的nx配置时,切换到lightdm,重启开机却出现了黑屏,所以执行第3步的话要有心理准备,黑屏解决方法见第5步,特此提醒。

胡乱学点东西 2万+

不止于连接:用VS Code Remote-SSH深度开发树莓派(Ubuntu 22.04环境实战)

本文详细介绍了如何在Ubuntu 22.04环境下使用VS Code的Remote-SSH功能进行树莓派深度开发。通过SSH配置、VS Code扩展安装和远程环境优化,开发者可以在本地高效编写代码,同时在树莓派上直接运行和测试,解决性能瓶颈问题。文章还提供了高级功能如端口转发、多项目管理和远程调试的实战技巧。

didui8202的博客 352

关于动态修改Layer层,修改对象以及子对象的layer层总结

using System.Collections;using System.Collections.Generic;using UnityEditor;using UnityEngine;using UnityEngine.AI;public class Example : MonoBehaviour{    void ChangeLayer(Transform trans, string tar...

W低小调W的博客 1万+

PX4飞控 vs 大疆A3:开源与闭源方案在无人机硬件架构中的实战对比

本文深入对比了PX4飞控与大疆A3在无人机硬件架构上的差异,分析了开源与闭源方案在工业级无人机开发中的优劣势。通过详细的硬件配置、传感器兼容性、扩展能力及性能测试数据,为开发者提供选型指南,特别适合需要自定义算法和复杂功能集成的项目。

a3b4c5的博客 891

Core Animation Programming Guide - Setting up layer objects

Setting Up Layer Objects Core Animation 的使用离不开 Layer 对象。Layer 管理着 app 可见的内容,为视觉内容和现实效果提供修改的选项。尽管在 iOS 中默认启用了 layer 功能,然而在 OS X 中要想获得 layer 带来的性能提示就只能手动地启用它。一旦 layer 被启用,就可以尽情的通过配置和操作 app 的 layer 来多的想要...

weixin_30875157的博客 181

ANPC三电平拓扑双脉冲试验的原理与实施

ANPC三电平拓扑因损耗低、谐波小、应力均衡而广泛应用,但其存在短、长两类换流通道,寄生电感和开关应力差异显著。短通道尖峰小、可靠性高;长通道应力严苛。因此需分别制定两套独立双脉冲测试方案,针对不同时段和器件(如T1、T5、T6、T4及对应二极管)全面考核开关特性。

嵌入式老牛的博客 360

CMake是什么?为什么学习CMake

CMake的主要作用和重要性,包括其在跨平台构建中的应用、如何支持多种编译器及操作系统,以及它在管理大型和复杂项目中的优势。

小鱼酱的博客 3874

影视CG角色建模与场景重建技术解析:从3D建模到后期合成全流程

3D建模是计算机图形学的核心技术之一,通过数学算法构建三维物体的数字表示。其原理基于多边形网格、曲面细分和材质贴图等技术,能够创建逼真的虚拟场景和角色。在影视制作领域,3D建模技术具有重要价值,可以实现传统拍摄难以完成的特效场景和虚拟角色。角色绑定技术让数字角色具备真实的运动能力,而材质渲染则赋予模型逼真的视觉质感。这些技术在影视预演、角色研究、粉丝创作等场景中广泛应用。本文以具体的CG项目为例,详细解析了从Blender建模到After Effects合成的完整工作流程,涵盖了3D建模和角色绑定等关键技术

weixin_30920597的博客 333

上位机图像处理和嵌入式模块部署(开篇)

【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】 图像处理是现实生活当中很实用的一门技术。工业上一般采用的是机器视觉,以传统算法和光源控制为主,部分采用了深度学习技术。而生活当中,则主要以二维码识别、人脸识别、车牌识别和ocr识别为主,这中间深度学习与AI扮演了很重要的角色。过去,市场上的商业收费软件,主要还是以传统设备厂商提供的上位机软件为主,那这一部分是不是结合最新的npu技术,应该做出一些新的东西出来呢?

嵌入式-老费,一个分享专业嵌入式知识的blog 1338

Baserow技术架构深度解析:开源无代码数据库平台实战部署指南

Baserow作为一款开源无代码数据库平台,为企业级应用开发提供了完整的解决方案。这款基于Python/Django和Vue.js/Nuxt.js构建的平台,不仅具备Airtable级别的用户体验,更通过微服务架构实现了高可用性和可扩展性。在数据主权日益重要的今天,Baserow的GDPR、HIPAA和SOC 2 Type II合规性使其成为企业自托管数据库的首选。 ## 🔍 技术架构解析:现

gitblog_00821的博客 842

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

Take Your Time:集成化2D开发工具提升资源管理与动画制作效率

2D游戏开发中的资源管理和动画制作是提升开发效率的关键技术。通过智能资源管道和可视化状态机,开发者能够自动化处理资源依赖关系,优化内存使用和渲染性能。这些技术不仅减少了重复劳动,还支持多平台适配和团队协作。在实际应用中,集成化工具如Take Your Time将资源处理、动画编辑和性能分析融为一体,帮助开发者快速构建复杂的2D场景和角色动画,显著提升项目迭代速度。

chubaisheng8627的博客 451

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

SO-101真机复现及Sim-to-Real之Isaac sim Isaac lab安裝(更新ing)

电脑配置系统:ubuntu24.04显卡:4060ti 16g内存:32g安装版本。

qq_36497771的博客 308

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

PointWorld: 动作条件的全场景3D点flow 预测(用同一种3D物理空间模态来表示状态和动作)

PointWorld: Scaling 3D World Models for In-The-Wild Robotic Manipulation

u013250861的博客 337

ajax返回[object,object],layer多层嵌套的错误

$.ajax({ type:'POST', dataType:'JSON', async:false, data: {}, url: 'xxx', contentType: 'app...

HuangES个人博客 2533

Swift 字面量详解:从基础语法到实战技巧

Swift字面量是源代码中直接书写的固定值,如42、"Hello"、true等,其类型由上下文推断。整数支持十进制、二进制、八进制及十六进制写法,并可用下划线提升可读性;浮点默认为Double,支持科学计数法与十六进制表示。字符串支持转义、多行与插值,原始字符串避免转义。字符需显式标注类型,数组与字典字面量需配合类型推断。nil仅用于可选类型。通过ExpressibleBy...协议,自定义类型也可支持字面量初始化。理解字面量的类型推断机制,有助于编写更安全、清晰的Swift代码。

2402_85743155的博客 326

Swift 常量详解:从 let 到编译期优化

Swift中,常量使用let声明,一旦赋值不可更改,强调代码安全与可读性。推荐优先使用let,仅在需要变化时用var。常量支持类型推断或显式声明,可存基本类型、集合、元组、可选值及引用类型。注意:let仅锁定引用,不锁定对象内部状态。合理使用常量有助于编译器优化,提升性能。最佳实践包括默认使用let、命名清晰、全局常量集中管理。养成“默认let、按需var”习惯,是写出高质量Swift代码的关键。

2402_85743155的博客 141

Swift 运算符详解:从基础到进阶

本文系统介绍Swift运算符体系,涵盖算术、赋值、比较、逻辑、区间、三元、空合、溢出及位运算符,强调类型安全与显式转换。重点讲解区间遍历、空合运算简化可选值处理、溢出运算符应用场景,并演示运算符重载与自定义方法。结合优先级与结合性规则,倡导使用括号提升可读性。总结指出:遵循类型一致、安全优先原则,善用内置特性,谨慎自定义,以提升代码健壮性与可维护性。

2402_85743155的博客 179
上一篇: Core Animation学习笔记—第一节Core Animation Basics
下一篇: Core Animation学习笔记—第三节Animating Layer Content
诚是张嘉诚
博客等级 码龄7年 15粉丝 24原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值