I´ve looked around but can´t find a solution...
I have a MPVolumeView
in my app to control the unit´s system volume. I changed the MPVolumeView
SliderThumbImage to an image of my own and what I´ve noticed is 2 bugs:
Bug 1 : The thumb image sometimes gets offset horizontally to the right. this usually happens when I run from Xcode and the phone´s volume is at maximum. see the image where the bug happened and I bring the volume down to a minimum. if I bring the volume to minimum, close the app and reopen it, it will be put at the correct location. I think it may have something to do with how the units volume translates into a value for the slider and where the image gets positioned according to said value, but I´m unsure how to solve this. Bug 1
Bug 2: Apple´s own volume indicator layer sometimes shows up and sometimes does not. I would rather it didn´t at all.
I use a view in the storyboard which I classed MPvolumeView
and then in the viewdidload
I use the following code to put the image
let faderknob : UIImage = UIImage.init(imageLiteralResourceName:"faderknob50.png")
func setVolumeThumbImage(_ image: UIImage?,for state: UIControl.State){
volumeView.setVolumeThumbImage(faderknob, for: .normal)
volumeView.showsRouteButton = false
}
setVolumeThumbImage(faderknob, for: .normal)
any help on how to fix theses 2 bugs would be great! Thanks