1

I am facing an issue on iOS 13 where the UIBarButton icon does not change when I switch the iOS theme.

I have created two sets of images for dark and light themes and added them to xcassets as shown in the image below.

xcassets config

When I change the theme, the image of that theme doesn't reflect but if I tap on it then it changes.

Steps and screen recording.

With segue

  1. Open VC1 in dark mode
  2. Switch to light (icon should have black border)
  3. Switch to dark (no change in icon)
  4. Change to light (no change in icon)
  5. Tap on icon, segue to VC2
  6. VC2 shows its bar button with correct theme icon with black border
  7. Tap on VC2 bar button
  8. VC1 shows correct theme icon with black border

I tried creating new bar button and assign same icon without a segue. Icon doesn't change neither when theme changes not when i tap it.

below is screen recording.

without segue

What could be the reason?

shim
  • 9,289
  • 12
  • 69
  • 108
ashishn
  • 410
  • 5
  • 18

1 Answers1

5

Had the same problem today. Looks like you completed the first step (making sure you switch "Appearances" for the image set to "Any,Dark" or "Any, Light, Dark".

Turns out you need to set "Render As" to "Original". (See screenshot). Once I did this it worked.

Screenshot: Change Render As to Original Image

shim
  • 9,289
  • 12
  • 69
  • 108
roktecha
  • 71
  • 5