2009-05-24 40 views
9

我想從iPhone SDK中提取默認的UIBarButtonItem圖標。我想他們可能被存儲在iPhoneSimulator平臺中,只能用於alpha-channel-only PNG,但我還沒有找到它。如何從iPhone SDK中提取UIBarButtonItem圖標?

我在找的是UIBarButtonSystemItemReply。 (對於那些懷疑甚至有一個有效的用例,我打算在表格行標題上使用它,用戶可以在其中發表回覆,在行中)

回答

4

Other.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 
+1

看到這裏的另一個工具,它的iOS 4.3文件https://github.com/davepeck/iphone-tidbits/tree/master/iOS-artwork – sdsykes 2011-09-05 14:56:17

+1

正如我在評論中提及的作品在下面的非接受答案中,我做了:在/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/D eveloper/SDKs文件夾中,我做了:`find。 -iname「* .png *」-print0 -exec cp {}〜/ tmp \;` – fatfreddyscat 2013-02-01 23:36:20

1

我不知道該怎麼做不過,我幾個月前對同樣的事情很好奇。您可能能夠初始化此UIBarButtonItem並通過循環遍歷UIView中的所有元素並轉儲NSImages來從中提取圖像。我不確定如何去做這件事,但我記得Erica Sadun寫了一篇關於使用全屏相機圖像的文章。我不允許添加鏈接,因此Google僅支持「erica sadun全屏相機」。

17

要複製所有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/ =>是目標目錄

0

這是一個古老的線程,但我發現它在谷歌。我使用下面的代碼成功地從系統項目初始化的UIBarButtonItems中提取圖像。所有的提取程序都沒有在iOS 6上執行,或者對我來說太複雜了。由於我只需要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]; 
      } 
     } 
    } 
} 

}

相關問題