gpt4 book ai didi

ios - UICollectionViewCell 上的 CGAffineTransform 没有给出预期的结果

转载 作者:行者123 更新时间:2023-11-29 13:00:27 24 4
gpt4 key购买 nike

我想让 UICollectionView 中当前选定的单元格“凸起”——它应该比相邻的单元格大。

我试过:

cell.transform = CGAffineTransformMakeScale(1.5, 1.5);

这确实使单元格变大了 - 但它会夹到 UICollectionView 框架并且单元格的重叠不正确 - 单元格将重叠在它左边的单元格顶部 - 但它会在右边的单元格“下方”

我希望它类似于 OSX dock 中的“放大”效果。

如何更改单元格的“Z”并使其不剪裁到 UICollectionView 的边界?

enter image description here

最佳答案

but it clips to the UICollectionView frame

尝试将您的 Collection View 的 clipToBounds 设置为 false。 z-index 仅适用于具有相同父 View 的 View 。

the cell will overlap on top of the cell left to it - but it will be "under" the cell right to it.

zPosition 在这里应该有所帮助。你可以这样设置

cell.layer.zPosition = 1; //standard is 0, don't forget to set it back to zero

如果你使用 xcode < 5 你需要包含 QuartCore

#include <QuartzCore/QuartzCore.h>

关于ios - UICollectionViewCell 上的 CGAffineTransform 没有给出预期的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19900764/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com