Reputation: 1349
This is cute ... I've copied the code from Apple's docs -- adding the lines about isUserInteractionEnabled for good measure -- but my MPVolumeView slider is totally unresponsive when I try and drag it. It does move appropriately when I click the volume button.
myVolumeViewParentView.backgroundColor = UIColor.clear
let myVolumeView = MPVolumeView(frame: myVolumeViewParentView.bounds)
myVolumeViewParentView.isUserInteractionEnabled = true
myVolumeView.isUserInteractionEnabled = true
myVolumeViewParentView.addSubview(myVolumeView)
When I look in the view debugger, I don't see any other view in front of it.
Any ideas? I saw a posting about this a couple of years ago, but there was no answer. Here's hoping the second time's the charm ...
Upvotes: 0
Views: 813
Reputation: 956
I had the same issue. What solved it for me was to give the volume view a height constraint if you don't explicitly set it's frame.
To test this do:
myVolumeView.clipsToBounds = true
If the volume view doesn't show than you know there's no frame. You than need to set it's frame or give it a height constraint.
Upvotes: 4