我应该用更多的 UIView 或更多的 CALayer 来组成一个复杂的 UIView 吗?

发布于 2024-08-06 01:38:52 字数 177 浏览 3 评论 0原文

我有一个复杂的视图,它由覆盖有其他图像和 2D 路径的基本图像组成。

我想知道如果通过为每个元素创建不同的 UIView 并将它们添加为复杂视图的子元素来组装复杂视图,或者我应该为每个元素创建不同的 CALayer 并将它们添加为复杂视图的子元素,会有什么不同视图的图层属性。

谢谢

tat0

I have a complex view which is composed of a base image overlaid with other images and 2D paths.

I wonder what difference will it make if a assemble the complex view by creating a different UIView for each element and adding them as children of the complex view or if I should instead create a a different CALayer for each element and add them as children of the complex view's layer property.

Thanks

tat0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

屋檐 2024-08-13 01:38:52

您应该详细说明您想要做什么,但我的经验法则是在我尝试增​​强用户界面(用户交互等)的情况下使用 UIViews,并且在我想要制作动画时使用图层一些东西或使用精灵。听起来您正在做后者,所以我建议向您的主视图添加新图层,而不是添加子视图。

You should elaborate on what you're trying to do, but my rule of thumb is to use UIViews for cases where I am trying to enhance the user interface (user interaction, etc.), and I use layers when I am wanting to animate something or use sprites. It sounds like you are doing the latter, so I would suggest adding new layers to your main view instead of adding sub views.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文