bundleForClass:
Returns the
NSBundle
object with which the specified class is associated.
+ (NSBundle *)bundleForClass:(Class)aClass
Parameters
- aClass
- A class.
Return Value of [NSBundle bundleForClass]
The
NSBundle
object that dynamically loaded aClass (a loadable bundle), the NSBundle
object for the framework in which aClass is defined, or the main bundle object if aClass was not dynamically loaded or is not defined in a framework.
Example of [NSBundle bundleForClass]
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *path = [bundle pathForResource:@"foo" ofType:@"txt"];