나는 이미 Json 형식 인 Api에서 URL을 가져올 수 있습니다. 그러나 이것은 이미지 URL입니다. 이제 URL에서 해당 이미지를 다운로드하고 컬렉션보기에 표시 할 수 있습니다. 나는 JSON
에서Api Url에서 이미지 다운로드 및 Alamofire를 사용하여 신속하게 컬렉션보기에 표시
override func viewDidLoad() {
super.viewDidLoad()
Alamofire.request(.GET, "http://\(platform).eposapi.co.uk/?app_id=\(apiID)&app_key=\(apikey)&request=&request=gallery", parameters: nil)
.responseJSON { response in
print(response.request) // original URL request
print(response.response) // URL response
print(response.data) // server data
print(response.result) // result of response serialization
if let JSON = response.result.value {
print("JSON: \(JSON)")
self.imageData = JSON as! Array<AnyObject>
print(self.imageData)
print("total number of images = \(self.imageData.count)")
for image in self.imageData{
print(image)
}
}
모든 이미지 URL이오고있다
코드가 있습니다. 나는 그것을 볼 수있다. 이제 해당 URL에서 이미지를 다운로드하고 컬렉션보기에 표시하는 방법. 아무에게도 신청할 수있는 방법을 알려주십시오.
내가 가진 이미지 URL은 다음과 같습니다
[http://chicoshorwich.com/img/14517241531454.jpg,
http://chicoshorwich.com/img/14517241944082.jpg, http://chicoshorwich.com/img/14517273984235.jpg, http://chicoshorwich.com/img/14517274885779.jpg, http://chicoshorwich.com/img/1451727556453.jpg, http://chicoshorwich.com/img/14614027267627.jpg, http://chicoshorwich.com/img/14517278515475.jpg, http://chicoshorwich.com/img/14614068518289.jpg, http://chicoshorwich.com/img/14616123258824.jpg, http://chicoshorwich.com/img/14614027528137.jpg, http://chicoshorwich.com/img/14517344227700.jpg, http://chicoshorwich.com/img/1461402768681.jpg, http://chicoshorwich.com/img/14614028323203.jpg, http://chicoshorwich.com/img/14614029485351.jpg, http://chicoshorwich.com/img/14614029565341.jpg, http://chicoshorwich.com/img/14614068296679.jpg] 총 이미지 수 = 16
해결 방법을 알려주십시오.
이 도움이됩니다 http://stackoverflow.com/questions/2499176/ios-download-image-from-url-and-save-in-device –
당신은 신속 @SubinKKuriakose –
그것을에 보낼 수 수 Alamofire로 훨씬 쉽습니다. 프로젝트에서 Alamofire를 사용할 수 있습니까? 할 수 있다면 정말 쉽지. – Ccr