Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>MPMoviePlayerController has a subview that takes up its entire bounds, and that subview has 3 gesture recognizers on it (in iOS 4.3).</p> <pre><code>mp = [[MPMoviePlayerController alloc] initWithURL:movieURL]; mp.frame = aRectangle; for (UIGestureRecognizer *g in ((UIView *)[mp.view.subviews objectAtIndex:0]).gestureRecognizers) { NSLog(@"g %@", g); } </code></pre> <p>will output:</p> <pre><code>g &lt;MPTapGestureRecognizer: 0x6224c30; baseClass = UIGestureRecognizer; state = Possible; cancelsTouchesInView = NO; view = &lt;MPSwipableView 0x6416100&gt;; target= &lt;(action=_tapGestureRecognized:, target=&lt;MPSwipableView 0x6416100&gt;)&gt;&gt; g &lt;UIPinchGestureRecognizer: 0x6224710; state = Possible; cancelsTouchesInView = NO; delaysTouchesEnded = NO; view = &lt;MPSwipableView 0x6416100&gt;; target= &lt;(action=_pinchGestureRecognized:, target=&lt;MPSwipableView 0x6416100&gt;)&gt;&gt; g &lt;MPActivityGestureRecognizer: 0x6224640; baseClass = UIGestureRecognizer; state = Possible; cancelsTouchesInView = NO; delaysTouchesEnded = NO; view = &lt;MPSwipableView 0x6416100&gt;; target= &lt;(action=_activityGestureRecognized:, target=&lt;MPSwipableView 0x6416100&gt;)&gt;&gt; </code></pre> <p>So there is already a GestureRecognizer that handles a single tap, but it isn't a UITapGestureRecognizer, but an MPTapGestureRecognizer (a custom recognizer for the movie player).</p> <p>If you create a generic view and add it to the movie player view hierarchy, you can add touches to it, but it blocks the touches to the movie player (so a single tap won't make the controls disappear).</p> <p>e.g.</p> <pre><code>UIView *aView = [[UIView alloc] initWithFrame:mp.view.bounds]; [aView addGestureRecognizer:tapGesture]; [mp.view addSubview:aView]; </code></pre> <p>This will get your tap, but you break the controls. There may still be a way to allow it to interact with the other gestures.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload