Search code examples
iosuiviewmpmovieplayercontroller

Blend MPMovieplayerController in background UIImageView


As the title says, I was trying make so that the corners of my MPMovieplayerController go underneath my UIView background image, but I don't know how to obtain this effect. The effect I would like to obtain is similar to the one you can see in the image. The corners of the piece of paper are slid in the background, but I would like the tip of the paper to be seen. Can this be achieved through code? enter image description here


Solution

  • Just put that part that is supposed to hide your video view (I will refer to it as your Mask View) on top of the parent view, after you have added the video view to that parent view.

    1. add video view to parent view
    2. add mask view to parent view

    The resulting view hierachy could look like the following:

    P=Parent View V=Video View M=Mask View

    top down view:

    PPPPPPPP
    PVVVVVVP
    PMVVVVVP
    PMMVVVVP
    PPPPPPPP
    

    left side view:

     MM
     VVVVVV
    PPPPPPPP