-textureNamed:
INDEX>Sprite Kit> SKTextureAtlas
テクスチャアトラスのデータストアからテクスチャを作成します
- (SKTexture *)textureNamed:(NSString *)name
解説
テクスチャアトラスのデータストアからテクスチャを作成します。
返り値
(SKTexture *)
新しいテクスチャ
引数
(NSString *)name
名前
フレームワーク
Sprite Kit
クラス
SKTextureAtlas
使用可能
iOS 7.0以降
定義
SKTextureAtlas.h
参照
@property textureNamestextureNames
例文
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];