Aplicar zoom em um UICollectionView bidimensional

Eu criei umUICollectionView que é horizontal e verticalmente. Tem diferenteUICollectionViewCells. Tudo está organizado corretamente. Agora eu estou tentando fazer issozoomable. oUICollectionViewCells também são redimensionados corretamente. Toda vez que oUIPinchGesture ocasiões, eu defino oitemSize dentro deUICollectionViewLayout dependem dascale.

TestLayout *layout =  (TestLayout *) self.collectionViewLayout;
CGSize newItemSize = CGSizeMake(_sizeItem.width * gesture.scale, 
                                _sizeItem.height * gesture.scale);
[layout setItemSize:newItemSize];

Aqui você pode ver o métodosetItemSize Estou ligando dentro do meu CustomLayout.

- (void)setItemSize:(CGSize)itemSize
{
    if (CGSizeEqualToSize(self.itemSize, itemSize)) return;

    _itemSize = itemSize;

//    [self prepareLayout];
    [self invalidateLayout];
}

Meu problema é saber, todos os itensresize no canto inferior direito e não sei como me concentrar exatamente no elemento meuUIPinchGesture estava.

Eu tentei mudar ocontentOffset toda vez que ogesture ocorre assim:

CGPoint posInView = [gesture locationInView:self];
CGPoint pointPinchTouch = CGPointMake(posInView.x - self.contentOffset.x,
                                      posInView.y - self.contentOffset.y);
CGPoint newOffset = CGPointMake(self.contentOffset.x * (gesture.scale * 2),
                                self.contentOffset.y * (gesture.scale * 2));
[self setContentOffset:newOffset animated:NO];

Mas eu nunca consegui ficar noCGPoint meuUIPinchGesture foi executado.

Além disso, quandoscrolling no todoUICollectionView, meucontentOffset está parado{0,0} quando oscroll não terminou. Então comece a beliscar, eu sempre acabo no canto superior esquerdo. Porque oUICollectionView parece não ter sido projetado para ser usado horizontal e vertical ao mesmo tempo, por isso também não posso usar odelegate métodos deUIScrollView parazooming. Talvez alguém possa me dizer como resolver esse problema.

questionAnswers(1)

yourAnswerToTheQuestion