【问题标题】:how to map design in iPhone objective C如何在 iPhone Objective C 中映射设计
【发布时间】:2011-03-21 19:19:04
【问题描述】:

我有一个问题,假设我有 1 个背景透明的 png,并且所有自定义设计都是他们的假设:http://www.creativetechs.com/iq/tip_images/iPhoneElements-Yahoo.png

我希望我在我的代码中添加了 png,我如何获取坐标并将这些图像坐标实现到 UIImageView 中,当它运行时,它可以从 png 中获取这些坐标并映射设计。

我知道他们可能有一些软件可以给出这些坐标的 plist 然后映射它请任何人指导我。谢谢。

【问题讨论】:

    标签: iphone integration plist


    【解决方案1】:

    这个问题/答案解释了如何创建子图像: Return a subimage from a UIImage

    我建议将坐标存储在 plist 中(如您所建议的那样)并使用上述方法从您的 sprite 表中创建每个子图像。

    (来自上述帖子的代码)

    CGRect fromRect = CGRectMake(0, 0, 320, 480); // or whatever rectangle
    
    CGImageRef drawImage = CGImageCreateWithImageInRect(image.CGImage, fromRect);
    UIImage *newImage = [UIImage imageWithCGImage:drawImage];
    CGImageRelease(drawImage);
    

    【讨论】:

    • 你能告诉我当我给出图像时哪个软件可以为坐标创建 plist 并且我不使用 cocos 我使用 UIKit 所以没有精灵表......!
    • 要编辑 plist,你可以 Xcode 或者更轻量级的东西,我使用Text Wrangler
    • 此软件 (zwoptexapp) 似乎可以满足您的需求。它会为你生成 plist 文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-16
    • 2016-09-28
    • 2014-05-16
    • 2011-11-07
    • 2012-02-13
    • 2011-08-09
    相关资源
    最近更新 更多