0

I would like to know about how to control IPhone's volume control in swift 3 when you have been down volume or up volume? I want to control it with my UISlider Volume to make it the same IPhone event.

Thank you!

Sarabjit Singh
  • 1,814
  • 1
  • 17
  • 28
Kristoff
  • 213
  • 1
  • 5
  • 10
  • Is [this question/answer](http://stackoverflow.com/questions/28471481/swift-detect-volume-button-press) useful to your case? – Ahmad F Feb 02 '17 at 08:39
  • yes, sure, I will implement it if user make down or up volume to call another func if I can know how can I track it. it is very useful no need user unlock their phone. thanks – Kristoff Feb 02 '17 at 08:43
  • Glad to help, if that was the answer for your question, I recommend to close it :) – Ahmad F Feb 02 '17 at 08:56

1 Answers1

0

To control the volume, just drag a view in Interface Builder (not View Controller, just View) then at the custom class type MPVolumeView. When you run the app on a real device (in simulator it does not show), you will be able to control the volume.

Toma
  • 2,764
  • 4
  • 25
  • 44
  • ok I will try this idea. if it works will check your answer as correct. thanks – Kristoff Feb 03 '17 at 01:58
  • @Kristoff, did it work? If it did not, try to connect an IBOutlet of the MPVolumeView and reply. – Toma Feb 05 '17 at 18:57
  • Can I have any screenshot ? how ? or missed something ? – Kristoff Feb 06 '17 at 07:00
  • @Kristoff, just drag a view in the view controller, and at the custom class of the view type MPVolumeView. Then, create a new Swift file and a view controller class, assign it to the view controller and create an IBOutlet here. There is no screenshot as it is not visible in storyboard or simulator, just on a real device. – Toma Feb 06 '17 at 07:25
  • Oh yes, it showed but I can not swipe it. what I want to do is I can use phone control and user can swipe control also (both). Thanks – Kristoff Feb 07 '17 at 02:04
  • What do you mean by "I can not swipe it" ? And could you, please, explain better what you want to do? – Toma Feb 08 '17 at 18:26
  • yes, Now it's working well. Thank you so much for help – Kristoff Feb 09 '17 at 02:59
  • I'm happy to hear that! Anytime! – Toma Feb 09 '17 at 07:28