iphone - How can I move (animated) UICollectionView cells in and out of a circular shape [PICS] -
i using custom layout position uicollectionviewcells so:
this works great. now, when press button in bottom-left corner, have of cells animatedly return center of view, so:
i kind of have working, isn't animating @ all. kind of pops in way. here code using reload action:
- (ibaction)animate:(id)sender { [self.collectionview performbatchupdates:^{ [self.collectionview reloadsections:[nsindexset indexsetwithindex:0]]; } completion:nil]; }
and in layout class, have flag flipping each time preparelayout called adjusts center of cell in layoutattributesforitematindexpath
this:
- (uicollectionviewlayoutattributes*) layoutattributesforitematindexpath:(nsindexpath *)path { uicollectionviewlayoutattributes *attributes = [uicollectionviewlayoutattributes layoutattributesforcellwithindexpath:path]; attributes.size = cgsizemake(item_sizew, item_sizeh); if (self.iscircle) { attributes.center = cgpointmake(_center.x +_radius * cosf(2 * path.item * m_pi / _cellcount), _center.y + _radius * sinf(2 * path.item * m_pi/ _cellcount)); } else { attributes.center = [self collectionview].center; } return attributes; }
how can animate cell's movement center of view?
well, found answer. make different layout , switch animation:
[self.collectionview setcollectionviewlayout:home animated:yes];
Comments
Post a Comment