Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d3643e

Browse files
author
Jim Puls
committed
Add README
1 parent8487e8b commit5d3643e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#objc-assetgen
2+
3+
Xcode 5 has an awesome new feature called "[asset catalogs](https://developer.apple.com/technologies/tools/features.html)", allowing you to specify all of your image variants and resizable cap insets in a single place.
4+
5+
Unfortunately, to get the full benefits, you have to set your deployment target to iOS 7; otherwise, Xcode will dutifully put all of the images into your app bundle but totally ignore all of your resizable insets with only a build warning.
6+
7+
But shucks! The important and awesome part is the editor, and it puts all of the data out in super-readable JSON. We should be able to do a poor man's version that reads in the data and spits out some code to give you most of the benefits.
8+
9+
##Usage
10+
11+
Call`objc-assetgen` with the`.xcassets` paths as arguments from the directory into which it should output the code.
12+
13+
For an asset catalog named "Foo" containing image sets "Bar" and "Baz", you'll get`WQFooCatalog.h` and`WQFooCatalog.m`, with class methods`+ (UIImage *)imageForBar` and`+ (UIImage *)imageForBaz`. Put them in your DerivedSources folder and you're good to go.
14+
15+
##Command-line options
16+
17+
There are none. The class prefix is hardcoded as`WQ` and the output directory is hardcoded as the current one. We should fix this.
18+
19+
##Future plans
20+
21+
Maybe swizzle`+[UIImage imageNamed:]`?

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp