I am trying to change the default images for UISliders using Swift. I am editing didFinishLaunchingWithOptionsat AppDelegate.
In Objective-C, you will do the following:
UIImage *maxImage = [UIImage imageNamed:@"slider-track.png"];
[[UISlider appearance] setMaximumTrackImage:maxImage forState:UIControlStateNormal];
I tried to convert to Swift, but was not successful:
var maxImage:UIImage = UIImage (named:"slider-track.png")
UISlider.setMaximumTrackImage(image: maxImage, forState: UIControlStateNormal)
The first line is beautiful, and the second gives an error.
What is the correct syntax for the second line?
thank
source
share