IPhone: one nib, different assets. Bundles?

One way to do this is to move all your artwork into a separate bundle and dynamically load it at runtime (sort of like a "media plug-in") Create a separate project and choose "Mac OS X / Framework & Library / Bundle. " Call it, say media. Bundle Move all your artwork into this project To make life easy, add an extra "Run Script" step to the target copying the built output from the build directory over to a subfolder under your main URL1 make it even easier, add the media bundle as a dependent project in your main project so it gets rebuilt automatically In your main project you'll need these two methods.

You can make them static methods under a BundleUtils class: (NSString *) bundleDirectoryFor:(NSString *) bundleName { NSString* basePath = NSBundle mainBundle resourcePath stringByAppendingPathComponent:NSString stringWithFormat:@"%@. Bundle", bundleName; return NSBundle bundleWithPath:basePath resourcePath; } + (NSString *) resourceInBundle:(NSString *)bundleName fileName:(NSString *)fileName { NSString *bundlePath = BundleUtils bundleDirectoryFor:bundleName; return bundlePath stringByAppendingPathComponent:fileName; } Now every time you want to access artwork in your bundle, you can get the path to the right file with: NSString* imageFile = BundleUtils resourceInBundle:@"media. Bundle" fileName:@"image.

Jpg"; UIImage* image = UIImage imageNamed:imageFile Obviously, the name "media. Bundle" can be substituted at runtime for a different one so you can switch to other bundles based on your app's needs. This is also a handy way to support downloadable content (say, as for-pay add-ons) One caveat: this assumes you need to load images dynamically at runtime via code.

But you also have static NIB files that have media embedded in them. You'll have to figure out a way to make the static NIB file use the dynamic methods to resolve media file names. One way is to use MethodSwizzling and watch for filepaths with a prefix of type, say, "media:image.

Png" and redirect those to use the BundleUtil methods Another way is to do your layout with IB then convert it to Obj-C code using nib2objc and then substitute the plugin bundle mechanism Hope this helps.

One way to do this is to move all your artwork into a separate bundle and dynamically load it at runtime (sort of like a "media plug-in"). Create a separate project and choose "Mac OS X / Framework & Library / Bundle. " Call it, say, media.bundle.

Move all your artwork into this project. To make life easy, add an extra "Run Script" step to the target copying the built output from the build directory over to a subfolder under your main project. To make it even easier, add the media bundle as a dependent project in your main project so it gets rebuilt automatically.In your main project you'll need these two methods.

You can make them static methods under a BundleUtils class: + (NSString *) bundleDirectoryFor:(NSString *) bundleName { NSString* basePath = NSBundle mainBundle resourcePath stringByAppendingPathComponent:NSString stringWithFormat:@"%@. Bundle", bundleName; return NSBundle bundleWithPath:basePath resourcePath; } + (NSString *) resourceInBundle:(NSString *)bundleName fileName:(NSString *)fileName { NSString *bundlePath = BundleUtils bundleDirectoryFor:bundleName; return bundlePath stringByAppendingPathComponent:fileName; } Now every time you want to access artwork in your bundle, you can get the path to the right file with: NSString* imageFile = BundleUtils resourceInBundle:@"media. Bundle" fileName:@"image.

Jpg"; UIImage* image = UIImage imageNamed:imageFile; Obviously, the name "media. Bundle" can be substituted at runtime for a different one so you can switch to other bundles based on your app's needs. This is also a handy way to support downloadable content (say, as for-pay add-ons).

One caveat: this assumes you need to load images dynamically at runtime via code. But you also have static NIB files that have media embedded in them. You'll have to figure out a way to make the static NIB file use the dynamic methods to resolve media file names.

One way is to use MethodSwizzling and watch for filepaths with a prefix of type, say, "media:image. Png" and redirect those to use the BundleUtil methods. Another way is to do your layout with IB then convert it to Obj-C code using nib2objc and then substitute the plugin bundle mechanism.

Hope this helps.

Assuming that each app only needed one skin at a time, and that you are creating multiple apps with different themes, I would create a branch in my source control and then replace the necesary assets. You keep a master branch with all default assets and then you merge code changes from the master into your skinned branches keeping everything in sync. Git makes this super easy.

I think the best option is to use something like git. If you used git, you can have a main branch that holds the master source code and logic, and have sub branches that have different sets of data/images for each particular flavour of your application. In this solution, XCode wouldn't even know what's going on.

I think this is what viewDidLoad is for, to customize more, in here you can change the images path.

Bundle" can be substituted at runtime for a different one so you can switch to other bundles based on your app's needs. This is also a handy way to support downloadable content (say, as for-pay add-ons). One caveat: this assumes you need to load images dynamically at runtime via code.

But you also have static NIB files that have media embedded in them. You'll have to figure out a way to make the static NIB file use the dynamic methods to resolve media file names. One way is to use MethodSwizzling and watch for filepaths with a prefix of type, say, "media:image.

Png" and redirect those to use the BundleUtil methods. Another way is to do your layout with IB then convert it to Obj-C code using nib2objc and then substitute the plugin bundle mechanism. Hope this helps.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions