是否可以在MPMoviePlayerController上绘制anyhitng

时间:2012-05-29 06:41:36

标签: iphone mpmovieplayercontroller

是否可以在MPMovieplayercontroller中在线添加点数。 如果是,那么如何..Becoz,因为它可以在视图上绘制线条。然后MPMovieplayerconteoler也只是一个视图..

- (void)drawSquiggle:(Squiggle *)squiggle inContext:(CGContextRef)context
{
   // set the drawing color to the squiggle's color
   UIColor *squiggleColor = squiggle.strokeColor; // get squiggle's color
   CGColorRef colorRef = [squiggleColor CGColor]; // get the CGColor
   CGContextSetStrokeColorWithColor(context, colorRef);

   // set the line width to the squiggle's line width
   CGContextSetLineWidth(context, squiggle.lineWidth);

   NSMutableArray *points = [squiggle points]; // get points from squiggle

   // retrieve the NSValue object and store the value in firstPoint
   CGPoint firstPoint; // declare a CGPoint
   [[points objectAtIndex:0] getValue:&firstPoint];

   // move to the point
   CGContextMoveToPoint(context, firstPoint.x, firstPoint.y);

    // draw a line from each point to the next in order
   for (int i = 1; i < [points count]; i++)
   {
      NSValue *value = [points objectAtIndex:i]; // get the next value
      CGPoint point; // declare a new point
      [value getValue:&point]; // store the value in point

      // draw a line to the new point
      CGContextAddLineToPoint(context, point.x, point.y);
   } // end for

   CGContextStrokePath(context);   
} // end method drawSquiggle:inContext:

结束方法touchesBegan:withEvent:

这是我用过的代码.. mpPlayer是mpvideoplayer对象

但它无法在mpvideoplayer上绘制点... 有什么办法吗。请帮帮我..

1 个答案:

答案 0 :(得分:0)

IOS SDK中有一个示例,它具有播放影片的叠加视图。那应该是一个好的开始。

https://developer.apple.com/library/ios/#samplecode/MoviePlayer_iPhone/Introduction/Intro.html