Changing onTintColor of UISwitch on iOS7?

ios, ios7, uiswitch

Solution

UISwitch *switch = [UISwitch alloc] init];
[switch setOnTintColor:[UIColor customColor]];
[myView addSubview:switch];

does not work. But

UISwitch *switch = [UISwitch alloc] init];
[myView addSubview:switch];
[switch setOnTintColor:[UIColor customColor]];

works. Tint color does not change unless it is visible. Someone to explain?

Problem

Default `onTintColor` is green as I see it on iOS7 but I'd like it to be another color. ``` [myUISwitch setOnTintColor:[UIColor customColor]]; ``` does not work. `on/offImages` have no effect on iOS7 as documentation says. Why could it be not working? How can I change its `onTintColor`?

Original source