代码之家  ›  专栏  ›  技术社区  ›  Justin Searls

如何从iPhone SDK中提取uibarbuttonitem图标?

  •  9
  • Justin Searls  · 技术社区  · 16 年前

    我想从iPhone SDK中提取默认的uibarbuttonitem图标。我想他们可能是存储在iphoneSimulator平台上的alpha通道专用PNG,但我还没有找到它。

    我要找的是uibarbuttonsystemreply。(对于那些怀疑甚至存在有效用例的人,我希望在表的行标题上使用它,用户可以在其中按行发送答复)

    4 回复  |  直到 11 年前
        1
  •  4
  •   Simon Woodside    15 年前

    另一个.artwork文件在/developer/platforms/iphoneSimulator.platform/developer/sdks/iphoneSimulator3.0.sdk/system/library/frameworks/uikit.framework/中(您需要sdk)。

    使用“iphoneshop-1.3.jar”程序——目前可用 here 将所有图像提取到一个目录中。

    java -jar iPhoneShop-1.3.jar ARTWORK Other.artwork EXPORT Other
    
        2
  •  17
  •   Tim Cooper    13 年前

    要复制所有iPhone(或MacOS)系统图标,请转到目录:

    cd /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ 
    

    =>可能有多个iPhoneSimulator版本(iphoneSimulator4.3.sdk),只需选择您喜欢的版本即可。 然后执行以下命令:

    find . -iname "*.png*" -print0 | xargs -I{} -0 cp -v {} /tmp/iPhoneIcons/
    

    /tmp/iPhoneIcons/ =>是目标目录

        3
  •  1
  •   AriX    16 年前

    我不知道该怎么做,但几个月前我对同样的事情很好奇。您可以初始化这个uibarbuttonitem,并通过循环其uiview中的所有元素并转储nsImages从中提取图像。我不知道该怎么做,但我记得艾丽卡·萨登写了一篇关于使用全屏摄像机图像的文章。我不允许添加一个链接到它,所以只是谷歌的“埃里卡萨顿全屏相机”。

        4
  •  0
  •   Nick Frolov    11 年前

    这是一条旧线,但我在谷歌上找到了。我使用下面的代码,成功地从用系统项初始化的uibarbuttonems中提取图像。所有的提取器程序都不是在iOS6上执行的,或者对我来说太复杂了。因为我只需要5-6张照片,所以我只是手动获取。

    - (void)viewDidAppear:(BOOL)animated {
    
    UIView *v1 = self.navigationController.navigationBar;
    for (int i = 0; i < v1.subviews.count; i++)
    {
        UIView *v2 = [v1.subviews objectAtIndex:i];
        NSLog(@"%i %@", i, [v2 class]);
        if (i == 2)
        {
            for (int j = 0; j < v2.subviews.count; j++)
            {
                UIView *v3 = [v2.subviews objectAtIndex:j];
                NSLog(@"  %i %@", j, [v3 class]);
    
                if (j == 1)
                {
                    // In my test, this view was UIImageView containing button image
                    UIImageView *iv = [[UIImageView alloc] initWithImage:((UIImageView *)v3).image];
                    [self.view addSubview:iv];
                }
            }
        }
    }
    

    }