天天看點

[翻譯] MJParallaxCollectionView

mjparallaxcollectionview

[翻譯] MJParallaxCollectionView

<a href="https://github.com/mayuur/mjparallaxcollectionview" target="_blank">https://github.com/mayuur/mjparallaxcollectionview</a>

this is a parallax for the cells inside uicollectionview. it gives us an effect just like scrolling the images in whatsapp or scrolling through the weather app for ios.

這是一個cell的視差效果控件,用于uicollectionview當中。你可以在whatsapp以及weather app中檢視到這種效果。

setting it up is really simple.

設定非常簡單。

just create a nsstring array contaning all the names for the images. 設定一個帶有圖檔名字的字元串數組

set up the collection view datasource and delegate methods. 設定collectionview的datasource以及delegate代理方法

set the scrollviewdidscroll delegate method for your uicollectionview. 給你的uicollectionview設定scrollviewdidscroll的代理方法

that's it. now run! 就醬紫,直接運作吧!

optionally, you can change the animation speed for the images or the height of the images in the uicollectionviewcell by chnaging the constants used in mjcollectionviewcell.h

作為一個額外的操作(但不是必須的),你可以修改圖檔動畫的速度,也可以在 mjcollectionviewcell.h 檔案中修改圖檔的圖檔的高度。

thanks!

watch the demo below

[翻譯] MJParallaxCollectionView