Post

Replies

Boosts

Views

Activity

UIBarButtonItem not change image automatically when switching dark mode/light mode
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
2
0
2.2k
Mar ’20