Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>On MyAppNotificationUIThemeChanged every controller has to retrieve and set images for every UIImageView in it's main view. I can think of 2 approaches for doing this:</p> <p>1) Brute force. Something like this: </p> <pre><code>self.imageView1.image = [self currentThemeImage:@"someController_image1.png"]; self.imageView2.image = [self currentThemeImage:@"someController_image2.png"]; </code></pre> <p>2) Automated approach.</p> <pre><code>NSArray *imageViews = [self fetchAllImageViews]; foreach (UIImageView *iv in imageViews) { iv.image = [self currentThemeImageForTag:iv.tag]; } </code></pre> <p>where currentThemeImageForTag: is something like this:</p> <pre><code>- (UIImage*)currentUIThemeImageForTag:(NSUInteger)imageTag { return [self currentUIThemeImage:[NSString stringWithFormat:@"%@_%u.png", NSStringFromClass([self class]), imageTag]]; } </code></pre> <p>I also suggest to use NSBundle to package theme images and other resources.</p> <p><strong>Update:</strong></p> <p>I chose NSBundle only because of it's cool methods like pathForResource:ofType: and such and also ability to support localization. You can create bundle with XCode (just look under Mac OS X -> Framework&amp;Library section in new project dialog). Put your images in Resources, remove liks to any frameworks (there is no code anyway), build and that's it. In your app load bundle with <code>[NSBundle bundleWithPath:pathToDownloadedBundle]</code>. Beware though: I don't know if Apple allows to download bundles and use it's content in app. All I can guarantee is that it works on simulator.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload