스크롤에 포함 된 셀의 중심점을 가져 오기 : 나는 스크롤 뷰에 포함 된 UICollectionView를보기
각 흰색 사각형은 컬렉션 뷰 세포이다. 사용자는 수평으로 스크롤하여 추가 셀을 표시 할 수 있습니다.
사용자가 셀을 클릭하면 새 뷰 컨트롤러로 전환 될 때 셀이 자체 중심에서 바깥쪽으로 확장되는 애니메이션을 만들었습니다.
//cell is selected:
//grab snapshot of cell
UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
UIImage *cellImage = [self imageOfCollectionCell:cell];
//hold the snapshot in this dict
NSMutableDictionary *cellImageDict = [[NSMutableDictionary alloc]init];
[cellImageDict setObject:cellImage forKey:SELECTED_INBOX_EMAIL_IMAGE];
[ViewControllerSnapShotDictionary sharedInstance].vcdict = nil;
[ViewControllerSnapShotDictionary sharedInstance].vcdict = cellImageDict;
//get the center of the cell (HERE IS WHERE THE PROBLEM IS)
CGPoint cellCenter = CGPointMake(cell.center.x, cell.center.y);
//do the animation using the snapshot and cell center
[self startPinchingOutCellFromCenterPoint:cellCenter forTransitionTo:emailController withSnapShotImage:SELECTED_INBOX_EMAIL_IMAGE];
코드는 컬렉션 뷰가 스크롤 된 경우를 제외하고 잘 작동 : 여기
는 코드입니다. 애니메이션을 사용하려면 셀의 중심이 화면 상에 있고 터치 된 시점과 내가 본 시점의 좌표와 관련이있는 시점을 알 필요가 있습니다. 컬렉션 뷰가 스크롤, 나는 위의 이미지의 중심 셀을 선택하지 않은 경우예를를 들어, 센터는 반환 할 수 있습니다 :
cell.center.x = 490
cell.center.y = 374
을 그러나, 나는 스크롤을 할 경우 오른쪽 다음 새 중앙 셀을 선택, 내가 좋아하는 뭔가를 얻을 수 있습니다 :
cell.center.x = 1770
cell.center.y = 374
내 질문은, 내가하려고, 또는 얻을 수있는 방법이 무엇을 달성 할 수있는 더 좋은 방법 중 하나가 셀 중앙의 손잡이 self.view에서 현재 위치에?