訪問用特定格式存儲在asset catalog里面的一個對象,這是iOS9 SDK的新類,用于操作asset Category文件的。
- (instancetype)init NS_UNAVAILABLE;
/// Equivalent to -initWithName:name bundle:[NSBundle mainBundle];
- (nullable instancetype)initWithName:(NSString *)name;
/// Create a data asset with the given name from the given bundle. Returns nil if the asset was not found.
- (nullable instancetype)initWithName:(NSString *)name bundle:(NSBundle *)bundle NS_DESIGNATED_INITIALIZER;
/// The name used to reference the data asset
@property (nonatomic, readonly, copy) NSString *name;
/// The data for this asset, as stored in the asset catalog
@property (nonatomic, readonly, copy) NSData *data;
/// The Uniform Type Identifier for this data object.
@property (nonatomic, readonly, copy) NSString *typeIdentifier;
這里要特別注意一下,你在asset里建的文件一定是Data類型的,不然讀不出來
Data類型.png
Paste_Image.png
NSDataAsset *dataAsset=[[NSDataAsset alloc]initWithName:@"Data"];
NSLog(@"%@---%@---%@",dataAsset.name,dataAsset.data,dataAsset.typeIdentifier);
控制臺打印:
控制臺.png
不過這東西讓我想起了改變應用圖標icon,這里附上一個改變icon的帖子http://blog.csdn.net/qq_31810357/article/details/68489138