0

是否可以在 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 上绘制点。有什么办法吗。请帮帮我..

4

1 回答 1

0

IOS SDK 中有一个示例,它在播放的电影上具有覆盖视图。这应该是一个好的开始。

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

于 2012-05-31T23:31:07.903 回答