There is no current draw context. The issue is from where you are calling the draw methods. They need to be called from a -(void) drawRect method or, if you'd prefer, you can draw into an image. Either way, there has to be a current draw context.


必须从drawRect中触发才能取到绘画上下文。
或者自定义绘画区域进行绘画。

    UIGraphicsBeginImageContext(drawImage.frame.size);

    [drawImage.image drawInRect:drawImage.frame];

(取上下文操作)

 

    drawImage.image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext(); 

相关文章:

  • 2021-04-06
  • 2021-05-11
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2021-08-23
猜你喜欢
  • 2021-08-03
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
相关资源
相似解决方案