[英]How to reload data in table view by tapping the cell of collection view in swift
[英]How to animate a image from a collection view cell to move to full screen by tapping on it
我有圖像的水平滾動單節集合視圖
當您在collectionview
點擊第一張圖像時,圖像應以平滑過渡“增長”以占據全屏,而后面的屏幕則逐漸變為全黑。 輕觸圖像或右上角的“ x”將淡出該屏幕,並使您返回上一屏幕。
我可以從這種方法獲得圖像
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
如何實現這種動畫?
以下是示例圖片,
嘗試以下代碼:
[UIView animateWithDuration:1 animations:^{
//if u want to move it to center before you make it big use all code
imgView.center = self.view.center;
} completion:^(BOOL finished) {
[UIView animateWithDuration:1 animations:^{
//just use this if you want it to move to full screen
imgView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
}];
}];
希望這可以幫助 !
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.