0

I've been able to successfully overlay an image on top of the movieplayer (see the MoviePlayer example from Apple).

However, I would like the effect of having no controls on the screen, and when the screen is touched, my overlay appears.

My thought was to create an overlay with an image that is a transparent png file, and cover the entire display. When this transparent image is touched, the overlay control will appear.

All is working, with the exception of showing a transparent image over the movieplayer. Even with a transparent png, the image shows as all black. If I change the alpha for the UIView (overlay) the touch events are not recognized.

I'm obviously new to working directly with drawrect() so any insight would be appreciated.

2 Answers 2

0

There isn't really need to use drawRect. You can set your view up in IB if you wanted.

Your problem is finding the Movie Player View. You can try 2 things.

First try to add your view as a subview of the UIWindow instance of the app:

[window addSubview:myCustomTransparentTouchView];

See if it works.

If not, try looping through the subviews of the UIWindow instance:

for(UIView* aView in [window subviews]){

    NSLog([[aView class] description]);

}

And see if I see something like MPPlalerView or whatever it may be called.

Then, try adding whatever view you want as a subview of that:

[moviePlayerViewThatIFound addSubview:myCustomTransparentTouchView];

There is no guarantee that any of these will work, but they are probable solutions.

1
  • It's an interesting question, but the combination of the question and the selected answer don't provide enough context for a novice like myself to learn from your experience. May 8, 2011 at 18:16
0

Corey, thanks for the comments.

I've got a solution that works...if I create the transparent image in the initWithFrame, versus trying to draw a transparent image in drawRect, all is well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.