• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

objective-c - iOS 模拟器运行动画的效率会降低吗?

[复制链接]
菜鸟教程小白 发表于 2022-12-12 23:55:15 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我一直在玩一些动画,碰巧我附近没有可以测试的设备。我有一个简单的云在天空中移动的动画。使用此方法对云进行动画处理:

-(void)animateLayerCALayer*)layer toPositionCGPoint)position withDurationCGFloat)duration{
    // Prepare the animation from the current position to the new position
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath"position"];

    animation.fromValue = [layer valueForKey"position"];
    animation.toValue = [NSValue valueWithCGPoint:position];
    animation.delegate = self;

    animation.duration = duration;

    [animation setValue:layer forKey"cloudLayer"];

    // Update the layer's position so that the layer doesn't snap back when the animation completes.
    layer.position = position;

    // Add the animation, overriding the implicit animation.
    [layer addAnimation:animation forKey"position"];
}

图层包含一个简单的部分透明图像。但是,当我运行它时,cpu 利用率比我在 MacBook Air 上预期的要高得多。有什么我做的效率低吗?还是模拟器只是在动画等某些任务上消耗大量资源?



Best Answer-推荐答案


有区别。但在大多数系统上,实际上是有好处的。事情往往在计算机上运行得更好,因为改进的 RAM 和 CPU 速度实际上使事情变得更好。除非您的 RAM 高于 2 GB,否则 Macbook Air 可能不会大幅提升性能。

Wifi 也是如此,如果您有一台插入以太网的计算机,那么互联网的运行速度会比正常速度快。在开发时牢记这一点是很好的,尤其是在开发游戏时。

编辑

正如 Minthos 所指出的,OpenGL 可能无法正常工作。但是,我无法验证这一点,因为我不使用 OpenGL 开发东西。但是,我之前的观点在其他情况下仍然有效。简单的 Cocos2D 动画应该更喜欢模拟器。

关于objective-c - iOS 模拟器运行动画的效率会降低吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13766270/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap