iPhone UIButton with UISwitch functionality

scud picture scud · Feb 12, 2010 · Viewed 32.6k times · Source

Is there either a way to implement UISwitch with custom graphics for the switch-states? Or as an alternative the other way round, an UIButton with UISwitch functionality?

Answer

pgb picture pgb · Feb 12, 2010

UIButton already supports a "switch" functionality.

Just set a different image in Interface Builder for the "Selected State Configuration", and use the selected property of UIButton to toggle its state.