+atlasNamed:
INDEX>Sprite Kit> SKTextureAtlas
アプリケーションバンドルのデータストアからアトラスを作成する
+ (SKTextureAtlas *)atlasNamed:(NSString *)name
解説
アプリケーションバンドルのデータストアからアトラスを作成する。
テクスチャアトラスを見つけることが出来なければ例外を投げます。
返り値
(SKTextureAtlas *)
新しいテクスチャアトラス
フレームワーク
Sprite Kit
クラス
SKTextureAtlas
使用可能
iOS 7.0以降
定義
SKTextureAtlas.h
参照
例文
NSMutableArray *plateFrames = [NSMutableArray array]; SKTextureAtlas *plateAnimatedAtlas = [SKTextureAtlas atlasNamed:@"teppan"]; NSUInteger numImages = plateAnimatedAtlas.textureNames.count; for (int i=0; i < numImages; i++) { NSString *textureName = [NSString stringWithFormat:@"%03d", i]; SKTexture *temp = [plateAnimatedAtlas textureNamed:textureName]; [plateFrames addObject:temp]; } _plateFrames = plateFrames; SKTexture *temp = _plateFrames[0]; _plate = [SKSpriteNode spriteNodeWithTexture:temp]; _plate.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)); [self addChild:_plate];