내 목표는 아래 이미지의 것과 같이 종료시 원근감이 사라지는 셀이있는 UICollectionView를 만드는 것입니다. 그들이로드 할 때 UICollectionViewCell 투시도 표시/사라짐
NSArray *rows = [self.feedCollectionView indexPathsForVisibleItems];
for (NSIndexPath *path in rows) {
if (path.row != 1) {
continue;
}
UICollectionViewCell *cell = [self.feedCollectionView cellForItemAtIndexPath:path];
float height = cell.frame.size.height;
float position = cell.frame.origin.y - scrollView.contentOffset.y;
float offsetFromBottom = self.feedCollectionView.frame.size.height- position;
float fraction = MAX(((height - offsetFromBottom)/height), 0);
//float angleFormula = -((height - offsetFromBottom)/height)*M_PI/2;
float rotation = MIN(-((height - offsetFromBottom)/height)*M_PI/2, 0);
CGRect frame = cell.frame;
[self setAnchorPoint:CGPointMake(0.5, 0.0) forView:cell];
cell.frame = frame;
CATransform3D transform = CATransform3DIdentity;
transform.m34 = -1.0/(height * 4.6666667);
transform = CATransform3DRotate(transform, rotation, 1, 0, 0);
[cell.layer setAnchorPoint:CGPointMake(0.5, 0.0)];
cell.layer.sublayerTransform = transform;
float delta = asinf(fraction);
[cell.layer setTransform:CATransform3DMakeRotation(delta, 1, 0, 0)];
}
는 불행하게도, setAnchorPoint이 자연 장소에서 세포를 이동하고 전체 collectionView 혼란하게
다음과 같이 내 scrollViewDidScroll 위임 기능입니다. 그러나 앵커 포인트를 새 위치로 설정하지 않으면 셀의 위쪽 가장자리가 넓어지지 않기 때문에 정확한 원근감 변환을 수행 할 수 없습니다.원래 화면의 셀은 사라지고 다시 나타날 때까지 괜찮습니다. 그 시점에서 프레임이 신비하게 변경되었습니다. 화면에없는 모든 셀은 원래 문제가 있습니다. 그것은 UICollectionView 나를 셀에 anchorPoint 속성을 설정하는 데 문제가 보인다. Perspective 변환을 수정하여 anchorPoint가 다른 것처럼 작동하는 방법이 있습니까? 아니면 셀에 다른 앵커 포인트가있을 수 있다는 것을 받아들이도록 collectionview를 가져 오는 방법입니까?
자세한 정보를 제공 할 수 있습니까? – KostiaZzz