Images do not automatically templatize if loaded from nib in framework
| Originator: | motownavi | ||
| Number: | rdar://7298597 | Date Originated: | 13-Oct-2009 |
| Status: | Open | Resolved: | |
| Product: | Mac OS X | Product Version: | 10.5 |
| Classification: | Reproducible: | Yes |
13-Oct-2009 10:33 AM Avi Drissman: Starting in 10.5, images loaded via nib file get their template flag automatically set if their name ends in "Template". However, this is only the case for nibs that live directly in the application's resources folder. For nibs that live in a framework, this "auto-templatizing" fails to take place. A test app is attached. [edit: openradar does not support attachments; email me if you want it] The test app has a nib containing a window containing a button using an image named with a trailing "Template". The test app also has a framework containing a nib containing a window containing a button using an image named with a trailing "Template". Build and run it. Click the "Go" button. When the app loads the nib from the framework, the button contains an image. Note how the assert fails, in that the image used in the framework's nib is not automatically templated while the image used in the app's nib is. On the [redacted] list, Ken Ferry noted: Whoops! Yeah, this is not coming up through +[NSImage imageNamed:]. NSCustomResource is part of the Interface Builder runtime. #0 0x0012a91c in -[NSImage initByReferencingURL:] at NSImage.m:1384 #1 0x0012a910 in -[NSImage initByReferencingFile:] at NSImage.m:1345 #2 0x00017339 in -[NSCustomResource _loadImageWithName:] at NSCustomResource.m:110 #3 0x0001719b in -[NSCustomResource loadImageWithName:] at NSCustomResource.m:119 #4 0x00016569 in -[NSCustomResource awakeAfterUsingCoder:] at NSCustomResource.m:174 It's an oversight that this case wasn't updated to match +[NSImage imageNamed:].
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!