【问题标题】:Can I get a gif out of a custom MKAnnotationView?我可以从自定义 MKAnnotationView 中获取 gif 吗?
【发布时间】:2013-08-19 17:08:06
【问题描述】:

我需要从这个库中获取不同颜色的 gif:https://github.com/samvermette/SVPulsingAnnotationView

在库中,我可以访问 MKAnnotationView 层。但我需要生成的注释的动画 gif 才能在非 iOS 项目中使用。

【问题讨论】:

    标签: ios animation calayer gif mkannotationview


    【解决方案1】:

    我使用renderInContext 从 CALayer(结果)创建 png。然后我使用 python 创建了 gif。

    UIGraphicsBeginImageContextWithOptions(result.bounds.size, result.opaque, 0.0);
    [result renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSString *pngFilePath = [NSString stringWithFormat:@"%@/blue dot.png",docDir];
    NSData *data1 = [NSData dataWithData:UIImagePNGRepresentation(image)];
    [data1 writeToFile:pngFilePath atomically:YES];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-18
      • 2022-01-18
      • 1970-01-01
      • 2019-02-25
      • 2013-03-14
      • 2011-06-14
      • 2012-11-30
      • 1970-01-01
      相关资源
      最近更新 更多