Lê Khánh Vinh Lê Khánh Vinh - 12 days ago 7
iOS Question

IOS Add a Switch to navigation bar using storyboard

I'm trying to add a

Switch
as UINavigationBar Item through my storyboard. The problem is that when I connect to outlet or action. There is only 1 choice (UIBarItem) and no Switch Item. How can we add switch to UINavigationBar and control the on off state? Help is much appreciate. Thanks!

enter image description here

Tim Tim
Answer

The switch is inside the BarButtonItem. Find it in the hierarchy and drag from there.

enter image description here