안녕하세요, 나는 100 사진 url의 flickr에서 가져온 배열이 있습니다. 내가 UICollectionView를 사용할 때 내가 100 개 세포를 표시 만 8 세포가 화면에 있고 나는 아래로 스크롤 할 때 ("뭔가") 다음 8 그들은 이전과 같은 동일한 볼 때 나는스위프트 - UICollectionView 반복 셀 (복제)
func collectionView(collectionView: UICollectionView!, cellForItemAtIndexPath indexPath: NSIndexPath!) -> UICollectionViewCell!
과에 println을 실행 스위프트를 이길 방법을 알고
func collectionView(collectionView: UICollectionView?, numberOfItemsInSection section: Int) -> Int {
return self.photosUrls.count
}
그것은 100 개 세포를 만들지 만 세포가 항상 반복 ... 누구 : 그것은 배열의 내용이 내가 이것을 사용 100
하지만 콘솔에서 단지 8 시간 뭔가를 기록 XCode GM 시드의 새로운 버전에?
func collectionView(collectionView: UICollectionView!, cellForItemAtIndexPath indexPath: NSIndexPath!) -> UICollectionViewCell! {
let cell: ImageCell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as ImageCell
let imgUrl = photosUrls[indexPath!.row]
let api_url = NSURL.URLWithString(imgUrl)
let URLReq = NSURLRequest(URL: api_url)
let NSOpQ:NSOperationQueue = NSOperationQueue()
NSURLConnection.sendAsynchronousRequest(URLReq, queue: NSOpQ, completionHandler:{ (response: NSURLResponse!, data: NSData!, error: NSError!) -> Void in
if(error == nil){
cell.theWPImage!.image = UIImage(data: data)
}
})
return cell
}
코드를 추가합니다. 그것을보고 감사합니다 :) –