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

标签 ios objective-c uicollectionview uicollectionviewcell uicollectionviewlayout

enter image description here

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

有什么建议吗?

最佳答案

当你的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){
    }];
}

关于ios - 如何在uicollectionview中放大单元格的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40909742/

相关文章:

iphone - 导航栏中间的按钮

ios - 在 UITableViewCell 中委托(delegate) UICollectionView

iphone - 如何使用 AFNetworking 2.0 下载图像?

iphone - 嵌套的 UIScrollView

ios - 在 iPad 上的 UIWebView 中放置弹出框

ios - UITableViewCell 内的 UICollectionViewCell 不响应操作

ios - UICollection 的镜像滚动

ios - 使用 @testable 来自 XCTest 的 "Use of unresolved identifier"和 "value of type has no member"

objective-c - 在 iPhone 应用程序中动态更改 UI

objective-c - NSRegularExpression 提取两个 XML 标签之间的文本