.svg指向UIImage iOS的url
我正在从服务器获取.svg URL。如何从.svg url转换NSData并将其转换为UIImage。我得到的url类似于“”,我正在使用此代码.svg指向UIImage iOS的url,ios,objective-c,swift,cocoa-touch,Ios,Objective C,Swift,Cocoa Touch,我正在从服务器获取.svg URL。如何从.svg url转换NSData并将其转换为UIImage。我得到的url类似于“”,我正在使用此代码 NSURL *url = [NSURL URLWithString:urlString]; dispatch_queue_t callerQueue = dispatch_get_main_queue(); dispatch_queue_t downloadQueue = dispatch_queue_c
NSURL *url = [NSURL URLWithString:urlString];
dispatch_queue_t callerQueue = dispatch_get_main_queue();
dispatch_queue_t downloadQueue = dispatch_queue_create("com.test.svg", NULL);
dispatch_async(downloadQueue, ^{
NSData *imageData = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:imageData];
});
此函数将图像设置为零值。您不能将
.svg
加载为UIImage
,但您可以将UIWebView
加载为.svg
内容,因为iOS浏览器可以呈现svg
值得探索的一些线索可能是:
您还可以浏览第三方框架。plz请使用以下链接: