点击按钮UICollectionViewCell宽高变化
On Click button UICollectionViewCell Width and Height Change
我有 UIViewController
,在内部使用 UICollectionViewController
和单按钮,我想在单击按钮时更改 UICollectionViewControllerCell
,例如高度和宽度。
为集合视图实现委托
- (UICollectionViewTransitionLayout *)collectionView:(UICollectionView *)collectionView
transitionLayoutForOldLayout:(UICollectionViewLayout *)fromLayout
newLayout:(UICollectionViewLayout *)toLayout
并对您的按钮使用 IBAction 更改高度和宽度的值。
你能试试这个吗
[UIView transitionWithView:collectionView
duration:.5
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
//any animatable attribute here.
cell.frame = CGRectMake(3, 14, 100, 100);
} completion:^(BOOL finished) {
//whatever you want to do upon completion
}];
我有 UIViewController
,在内部使用 UICollectionViewController
和单按钮,我想在单击按钮时更改 UICollectionViewControllerCell
,例如高度和宽度。
为集合视图实现委托
- (UICollectionViewTransitionLayout *)collectionView:(UICollectionView *)collectionView
transitionLayoutForOldLayout:(UICollectionViewLayout *)fromLayout
newLayout:(UICollectionViewLayout *)toLayout
并对您的按钮使用 IBAction 更改高度和宽度的值。
你能试试这个吗
[UIView transitionWithView:collectionView
duration:.5
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
//any animatable attribute here.
cell.frame = CGRectMake(3, 14, 100, 100);
} completion:^(BOOL finished) {
//whatever you want to do upon completion
}];