如何在uicollectionview中放大单元格的内容

Par*_*ngh 5 objective-c ios uicollectionview uicollectionviewcell uicollectionviewlayout

在此处输入图片说明

在上图中,A、B、C、D、E 是集合视图的每个自定义单元格,我想像 c 单元格一样一一放大单元格。

有什么建议吗?

Him*_*iya 2

只需在您的 CollectionViewCell 单击时调用此方法即可

[self animateZoomforCell:cell]; // pass cell as collectionviewcell

-(void)animateZoomforCell:(UICollectionViewCell*)zoomCell
{
    [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{

        zoomCell.transform = CGAffineTransformMakeScale(1.6,1.6);
    } completion:^(BOOL finished){
    }];
}
-(void)animateZoomforCellremove:(UICollectionViewCell*)zoomCell
{
    [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{

        zoomCell.transform = CGAffineTransformMakeScale(1.0,1.0);
    } completion:^(BOOL finished){
    }];
}
Run Code Online (Sandbox Code Playgroud)