如何使用NSUrlConnection从服务器获取图像 [英] How to get image from server using NSUrlConnection

查看:127
本文介绍了如何使用NSUrlConnection从服务器获取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过发送一个带url的参数从服务器获取图像。

How to get image from server by sending one parameter with url.

必须使用GET HTTPRequest发送请求。

GET HTTPRequest has to be use to send request.

推荐答案

您可以从具有图像名称的图像的特定路径的服务器获取图像。

You can get image from server with specific path of that image with image name.

UIImage* serverImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString: @"http://example.com/image_name.png"]]];

然后你可以在任何你想要的地方使用 serverImage

then you can use serverImage anywhere you want.

这篇关于如何使用NSUrlConnection从服务器获取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆