Xcode 7: image assets with slicing don't display correctly in iOS 9 or 10.11

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.

Replies

Any update on this? I'm experiencing a similar issue on El Capitan beta 8 with NSDrawThreePartImage:

https://dl.dropboxusercontent.com/u/75477/NSDrawThreePartImage%20bug.png

(Vertical lines not present on 10.10)

I still have this issue in Xcode 7 GM. Anyone know of a workaround other than resizableImageWithCapInsets:?

Still present in XCode 7.0.1, OS X 10.11.


I tried to look in the built app to see if I could manually tweak the sliced images after building, but they appear to be locked up in an "Assets.car" file which I have no way to edit.


Oddly enough when I tried to make a simple example project for a bug report I couldn't reproduce it, so I tried deleting and re-creating all my asset catalogs and that fixed the issue for me.