I've been struggling with a problem in Xcode 7 related to image assets with the slicing option enabled. In short, my images are displaying like this:
http://junecloud.com/images/twitter/image-slicing-bug-1.png
When they should display like this:
http://junecloud.com/images/twitter/image-slicing-bug-2.png
You can recreate the bug pretty easily:
- Add an image asset to your project. I believe some amount of transparency (alpha channel) is necessary to trigger the bug.
- Turn on slicing for the image. In my case I'm using "Horizontal and Vertical", although any of the settings other than "None" seem to be affected.
- Set the deployment target to the latest SDK (iOS 9.0 or OS X 10.11). On iOS the problem seems to go away, even on iOS 9, if the deployment target is set to 8.0. On OS X this makes the problem somewhat less severe, though there are still lines where there shouldn't be.
I filed rdar://21736169 (iOS 9) and rdar://21735415 (OS X). They were both marked as duplicates of rdar://21503485. Bug Reporter says that bug has been closed (which is all I can see about it). It's been that way for a while—well before the latest Xcode and El Capitan betas were released. It's hard to believe something so basic would not be fixed before release, but at this point I can't keep crossing my fingers—I need to find a workaround.
So far the only real workaround I've found on iOS is to turn off image slicing and use UIImage's resizableImageWithCapInsets:. That's easy enough. On OS X, the only equivalent option I'm aware of is NSDrawNinePartImage(). That requires me to split all of my stretchable images into 9 files each. I really don't want to do that. It was really nice back when I was able to stop doing that. If anyone has any other other suggestions I would love to hear them.
I am a little tempted to just draw these in code, but I really prefer to have design elements as images, so major changes can be made easily, and entirely by a designer if necessary.