MPMoviePlayerController adding UIButton to view that fades with controls

后端 未结 1 1031
醉酒成梦
醉酒成梦 2020-12-30 19:01

I am trying to add a UIButton to the view of a MPMoviePlayerController along with the standard controls. The button appears over the video and works as expected re

相关标签:
1条回答
  • 2020-12-30 19:10

    My solution to the same problem was:

    • Add the button as a child of the MPMoviePlayerController's view;
    • fade the button in and out using animation of its alpha property, with the proper durations;
    • handle the player controller's touchesBegan, and use that to toggle the button's visibility (using its alpha);
    • use a timer to determine when to hide the button again.

    By trial-and-error, I determined that the durations that matched the (current) iOS ones are:

    • fade in: 0.1s
    • fade out: 0.2s
    • duration on screen: 5.0s (extend that each time the view is touched)

    Of course this is still fragile; if the built-in delays change, mine will look wrong, but the code will still run.

    0 讨论(0)
提交回复
热议问题