UICollectionView
백엔드 제공 업체에서 다운로드 한 사진을 올리고 내 컬렉션 뷰 컨트롤러가 초기화 될 때마다 필요한 방법 인 문제를 실행하고 싶습니다.
- (NSInteger) collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
코드를 제공 했음에도 불구하고 항상 0을 반환합니다 [self.profilePicturesStorage count]
. 나는 블록을 사용하여 self.profilePicturesStorage
속성 을 채우기 때문에 뷰 초기화시 항상 0을 반환 한다는 것을 이해합니다 (블록이 실행을 완료하지 않았기 때문에) 내 질문은 내 블록이 모두 다운로드를 마친 후 CollectionView의 numberOfItemsInSection:
메서드를 어떻게 업데이트합니까? 사진, 그림?
이것은 내가 실행하는 블록입니다 viewDidLoad
.
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error){
if ([objects count] > 0){
//... Skip additional code that parse out the downloaded objects
[self.profilePicturesStorage addObject:userPicture];
}
}
else {
NSLog(@"There aren't any pictures for the current user");
}
}
}];
감사!
[collectionView reloadData]
필요한 모든 것입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다