Apple uses bundles to represent apps, frameworks, plug-ins, and many other specific types of content. Bundles organize their contained resources into well-defined subdirectories, and bundle structures vary depending on the platform and the type of the bundle.
-[NSBundle bundleForClass:]
gives you the bundle for a given class.
For example:
AwesomeApp:
AppController
FrameworkA:
FrameController
Calling in the AppController -[NSBundle bundleForClass:[self class]]
would return the AwesomeApp.app bundle. And within FrameController
it would return the FrameworkA.framework
-
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…