{{outline}} !!!assert *NSAssert( condition, NSString *description ) **Target Outputには止まった箇所(ソース名/行番号など)が出力される。 **descriptionはログに出力される。(けど、ログって何?) **descriptionに引数を付けることも出来る。(NSAssert1〜5まである) NSAssert1( condition, @"%d", 123 ); NSAssert2( condition, @"%d %f", 123, 4.56f ); **NS_BLOCK_ASSERTIONSが定義されていると無効になる。 ***Releaseのビルドオプションに-DNS_BLOCK_ASSERTIONSを追加。 !!!printf *NSLog( NSString *format, ... ) **無効化(参考サイト:[リリースビルド時にNSLogを自動で一括削除する(Snow Leopard対応版)|http://iphone-dev.g.hatena.ne.jp/tokorom/20100421/1271861868]) #define NSLog( args... ) NSLog( args, 0 ) !!!クラス *クラスのインスタンス変数は、メモリ上にインスタンスが割り当てられるときにnilで初期化される。 !!!プロパティ !!違う名前でproperty/synthesize { int hoge_; } @property (readonly) int hoge; @synthesize hoge = hoge_; !!nonatomicにしないと参照しただけでretainCountが増える *[Objective-Cの宣言プロパティにはまる|http://d.hatena.ne.jp/rabbit2go/20101214/1292319921] / Basic !!!View/ViewController *ビューをプログラムで構築している場合は、ビューの作成コードをView ControllerのloadViewメソッドに記述します。(「iOS View プログラミングガイド」より) *ビューをプログラムで作成するかnibファイルからロードするかにかかわらず、viewDidLoadメソッドにはビューの設定コードを追加で きます。(「iOS View プログラミングガイド」より) *initでビューを作成(self.viewをalloc)するとloadViewやviewDidLoadが呼ばれない。 !!!シングルトン *[シングルトンインスタンスの作成|http://developer.apple.com/jp/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_10.html] / developer.apple.com *[デザインパターンをObjective-Cで - Singleton (1)〜(3)|http://news.mynavi.jp/column/objc/050/] / マイナビニュース *[継承して使えるSingletonクラス|http://d.hatena.ne.jp/Yudoufu/20090318/1237385821] / ゆどうふろぐ **インスタンスの保持にNSMutableDictionaryを使用。 *[Singleton(dispatch_once版)|http://blog.heartofsword.net/archives/tag/objective-c] / らいふログ **未検証(dispatch_onceって何?) !!!autoreleaseをさっさとreleaseさせる方法 *[autoreleaseのひみつ|http://togetter.com/li/88945] / togetter(splhack) for() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; /* 処理 */ [pool drain]; } !!!ARC *[ARC (Automatic Reference Counting) : Overview|http://blog.natsuapps.com/2011/11/ios5-arc-overview.html] / Natsu's note !!!Scheme *Debug用とRelease用のSchemeを作成すると便利。 **[Product]-[Edit Scheme],[New Scheme],[Manage Schemes]あたりで作成/編集。 **デバイス選択のところでSchemeを選択出来るようになる。 !!!デバッグ *[Scheme]-[Run]-[Arguments]のEnvironment Variablesに下記の定義をすると色々分かって便利らしい。 NSZombieEnabled YES NSDebugEnabled YES MallocStackLogging YES **NSZombieEnabledはメモリ消費が激しいので注意。 ***deallocしてもメモリを解放しないため。 **Xcode4では[Product]-[Edit Scheme]-[Run]-[Diagnostics]内のチェックボックスで設定できる。 !!!本体仕様 !!解像度 ,機種,解像度,ドット数比率,note ,iPhone,480 x 320,3:2, ,iPhone,960 x 640,3:2,Retina ,iPhone5,1136 x 640,71:40,Retina ,iPod touch,960 x 640,3:2, ,iPod classic,320 x 240,4:3, ,iPad2,1024 x 768,4:3, ,新しいiPad,2048 x 1536,4:3,Retina !!CPU !ARMv6 *iPhone *iPhone 3G *iPod Touch 1st~2nd generation !ARMv7 *iPhone 3GS *iPhone 4 *iPhone 4S *iPad *iPad2 *iPod Touch 3rd~4th generation !ARMv7s *iPhone 5 *iPod Touch 5th generation !!グラフィックチップ *PowerVR MBX **iPod Touch 1st~2nd generation **iPhone **iPhone 3G *PowerVR SGX **iPod Touch 3rd~4th generation **iPhone 3GS **iPhone 4 **iPad (SGX535) **iPad2 (SGX543MP2) **新しいiPad (SGX543MP4) !!!グラフィック !!圧縮テクスチャ(PVRTC) texturetool -e PVRTC -o out.pvr -f PVR in.png texturetool -e PVRTC --bits-per-pixel-2 -o out.pvr -f PVR in.png texturetool -e PVRTC --channel-weighting-perceptual -o out.pvr -f PVR in.png *[iPhone でテクスチャ圧縮 (PVRTC) を使う|http://webos-goodies.jp/archives/using_compressed_textures_in_iphone.html] / WebOS Goodies !!!サウンド !!ライブラリ !!!AVAudioPlayer *重い。playやprepareToPlayで10msとか20msとか掛かる。 !!!OpenAL *未検証 !!コンバート *ターミナルで.wavから.caf(ima4)に一括コンバート find . -name '*.wav' -exec afconvert -f caff -d ima4 {} \; !!!OpenGL ,グラフィックチップ,OpenGLのバージョン,2Dテクスチャの最大サイズ ,PowerVR MBX,OpenGL ES1.1のみ,1024x1024 ,PowerVR SGX,OpenGL ES2.0もOK,2048x2048 *テクスチャサイズは2のべき乗。(ES1.1の仕様、2.0は不明) **縦/横は違うサイズでもOKぽい。 !!!Retina対応 *[[UIScreen mainScreen] bounds]の値はRetinaでも通常と同じ。((0,0,320,480)など) *Retinaでは[UIScreen mainScreen].scale=2.0になっている。 **scaleは4.0以降にしか存在しない。 **iPadはscale=1.0 *関連リンク **[Simulator iPhone Retina has wrong screen resolution|http://stackoverflow.com/questions/4772647/simulator-iphone-retina-has-wrong-screen-resolution] / stackoverflow **[OpenGL ESのRetina対応|http://www.comgate.jp/taiatari/archives/206] / Taiatari !!!tips *[iOS日本語ドキュメント|https://developer.apple.com/jp/devcenter/ios/library/japanese.html] / iOS Dev Center *[Xcode 4.2 for Snow LeopardにiOS5.1 SDKを入れる|http://www.iwazer.com/~iwazawa/diary/2012/03/ios51-to-xcode-42-for-snow-leopard.html] / IwazerReport