animation - Animating a UICollectionViewCell: Scroll To And Resize At The Same Time -


i'm trying uicollectionviewcell animated resize , @ same time have collection view scroll cell top of collection view's viewport.

when do

- (void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath {     [self.collectionview scrolltoitematindexpath:indexpath atscrollposition:uicollectionviewscrollpositiontop animated:yes];     [collectionview performbatchupdates:nil completion:nil]; } 

with

- (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath {     uicollectionviewcell *cell = [self.collectionview cellforitematindexpath:indexpath];      if (cell.isselected) {         return self.collectionview.frame.size;     }     else {         return cgsizemake(300, 100);     } } 

the scroll happens before resize animation.

and if call scrolltoitematindexpath inside of performbatchupdates like

- (void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath {     [collectionview performbatchupdates:^{         [self.collectionview scrolltoitematindexpath:indexpath atscrollposition:uicollectionviewscrollpositiontop animated:yes];     } completion:nil]; } 

it doesn't work of time.

thanks!

-eric

the best way achieve effect subclass uicollectionviewflowlayout , tweak cell layout attributes based on selected cell.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -