我尝试从该URL获取图像。
http://open.mapquestapi.com/staticmap/v3/getmap?type=map&size=225,160&pois=purple-1,51.466407,-0.952418,0,0%7Cpurple-2,51.466102,-0.958293,0,0%7C¢er=51.466252499999996,-0.9553555&zoom=12&key=Kmjtd%7Cluu7n162n1%2C22%3Do5-h61wh&rand=2031817700&session=4eeb5481-00f2-0000-02b7-64f1-002655800398
我可以成功获取URL以.jpg等结尾的图像,但不能由此获得。
我正在使用以下代码
UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:url]];
有可能,如果可以的话,我将如何处理?
最佳答案
您想使用NSData datawithContentsOfURL
[UIImage imageWithData: [NSData dataWithContentsOfURL:[NSURL URLWithString:route.mapURL]]];
关于ios - 从网址加载图片,图片的网址不以.jpg等结尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8535950/