【发布时间】:2013-08-19 17:08:06
【问题描述】:
我需要从这个库中获取不同颜色的 gif:https://github.com/samvermette/SVPulsingAnnotationView
在库中,我可以访问 MKAnnotationView 层。但我需要生成的注释的动画 gif 才能在非 iOS 项目中使用。
【问题讨论】:
标签: ios animation calayer gif mkannotationview
我需要从这个库中获取不同颜色的 gif:https://github.com/samvermette/SVPulsingAnnotationView
在库中,我可以访问 MKAnnotationView 层。但我需要生成的注释的动画 gif 才能在非 iOS 项目中使用。
【问题讨论】:
标签: ios animation calayer gif mkannotationview
我使用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];
【讨论】: