NSData+YYAdd.m 563 B

1234567891011121314151617181920212223
  1. //
  2. // NSData+YYAdd.m
  3. // YYKit <https://github.com/ibireme/YYKit>
  4. //
  5. // Created by ibireme on 13/4/4.
  6. // Copyright (c) 2015 ibireme.
  7. //
  8. // This source code is licensed under the MIT-style license found in the
  9. // LICENSE file in the root directory of this source tree.
  10. //
  11. #import "NSData+YYAdd.h"
  12. @implementation NSData (YYAdd)
  13. + (NSData *)dataNamed:(NSString *)name {
  14. NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@""];
  15. if (!path) return nil;
  16. NSData *data = [NSData dataWithContentsOfFile:path];
  17. return data;
  18. }
  19. @end