Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong image is shown in interface image in WatchKit

Tags:

swift

watchkit

I'm seeing a bug in WatchKit where it shows a wrong image when assigned by name programmatically or from the storyboard. Am I doing anything wrong here?

How to reproduce

  1. Add images to the WatchKit app with names image_1.png and image_10.png.
  2. Set the first image to the interface image: image.setImageNamed("image_1")

Expected behaviour

First image image_1.png is shown.

Actual behaviour

Second image image_10.png is shown.

Tested in Xcode

  • Version 6.2 (6C131e)
  • Version 6.3 (6D532l)

Demo

https://github.com/evgenyneu/watch-image-glitch-demo

Update

This bug has been submitted to Apple Bug Reporter. Apple confirmed that this is a bug.

like image 556
Evgenii Avatar asked Jan 25 '26 04:01

Evgenii


1 Answers

You should definitely file a Serious Bug radar. I pulled down your sample project (great work by the way) and ran it. I'm certainly seeing the same behavior on Xcode 6.2 (6C131e).

I also moved the images into the xcassets bundle which didn't have any affect on the issue. The only thing that I noticed is that renaming the image_10 to image_11, image_12 or image_100 did fix the problem. It appears that only image_10 is the culprit.

like image 128
cnoon Avatar answered Jan 29 '26 08:01

cnoon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!