【问题标题】:How do I cut a UIImage from a sprite sheet?如何从精灵表中剪切 UIImage?
【发布时间】:2013-08-01 19:15:11
【问题描述】:

我有一个包含许多图像的精灵表。我使用texture packer 创建了精灵表,它输出了一个包含每个图像尺寸和坐标的plist。鉴于此信息,我需要采取哪些步骤来提取单个 UIImages?我发现的所有示例似乎都在 Cocos2d 的上下文中,它有自己的数据格式和辅助类。我不是在创建动画或任何花哨的东西,这也不是 Cocos2d 应用程序。我只需要剪切图像。

谢谢!!

【问题讨论】:

    标签: iphone ios6 uiimage sprite-sheet


    【解决方案1】:

    我找到了答案here

    CGImageRef imageRef = CGImageCreateWithImageInRect([largeImage CGImage], cropRect);
    UIImage *image = [UIImage imageWithCGImage:imageRef];
    CGImageRelease(imageRef);
    

    【讨论】:

      猜你喜欢
      • 2012-12-06
      • 2012-08-27
      • 2019-11-14
      • 2013-09-18
      • 1970-01-01
      • 2016-04-06
      • 1970-01-01
      • 2019-03-10
      • 2013-11-29
      相关资源
      最近更新 更多