0 Replies
      Latest reply on Mar 26, 2020 7:36 PM by thaoth58
      thaoth58 Level 1 Level 1 (0 points)

        Hi all,

         

        I am trying to integrate dark mode support to my app. But when setting image icon for UIBarButtonItem, it seem only works when the first time UIBarButtonItem is shown, it is not changed when I switch between dark mode/light mode.

         

        When using that image with other UIButton, it works fine.

         

        P/s: I have to use that trick for updating image:

         

                let item: UIBarButtonItem = UIBarButtonItem()
                let button: UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 26, height: 19))
                button.setImage(UIImage(named: "hamburger"), for: .normal)
                button.addTarget(self, action: action, for: .touchUpInside)
                item.customView = button