LoginSignup
3
2

More than 5 years have passed since last update.

gyp で Xcode の Asset Catalog (*.xcassets) を利用する

Posted at

gyp で Xcode の Asset Catalog (*.xcassets) を利用する

はじめに

Xcode 5 移行では Asset Catalog を使うと画像を管理しやすくなります。

gyp でも利用できます。

前提条件

  1. 開発環境: Xcode 5 以降
  2. Deployment target: iOS 7 または OS X 10.9 以降
    • Apple のドキュメントにはこう書かれているが、実際には iOS 5 でも利用可能

利用方法

  1. Asset Catalog を用意する
  2. *.gyp の mac_bundle_resources に Asset Catalog を指定する
  3. *.gyp の xcode_settings に設定を追加する
    1. App Icon を設定する
      • ASSETCATALOG_COMPILER_APPICON_NAME に Set List 名を指定する
    2. Launch Image を設定する
      • ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME に Set List 名を指定する

利用例

example.gyp
...

'mac_bundle_resources': [
  ...
  'Images.xcassets',
  ...
],

'xcode_settings': {
  ...
  'ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon',
  'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME': 'LaunchImage',
  ...
},

...

App IconLaunch Image どちらかだけを指定しても問題ありません。

参考資料

  1. About Asset Catalogs
  2. Asset Catalog の AppIcon を使って複数ターゲットで出し分ける - jarinosuke blog
  3. Xcode 5 で AssetCatalog 使うと iOS6 以下でアイコンの Gloss Effect がオフに出来ない? - Qiita
  4. Xcode5でビルドするとiOS6の端末でアイコンにグロス(光沢)が付いてしまう問題の解決策 - ふぃすたぶろぐ
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2