LvJianfeng / LLCycleScrollView

Swift - 轮播图,文本轮播,支持左右箭头
MIT License
371 stars 65 forks source link

下拉放大效果 #54

Closed applepeopletsai closed 5 years ago

applepeopletsai commented 5 years ago

Hi, @LvJianfeng 大大你好 我想請問一下 我做了一個這樣的效果,如附件的影片

影片.zip

效果看起來不錯 但有個小問題 就是xcode會有constraint的錯誤,如下 The behavior of the UICollectionViewFlowLayout is not defined because: the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values. The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7ff06150fde0>, and it is attached to <UICollectionView: 0x7ff06184e800; frame = (0 0; 320 320); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x6000034c83c0>; layer = <CALayer: 0x600003aabbc0>; contentOffset: {53120, 0}; contentSize: {96000, 320.5}; adjustedContentInset: {0, 0, 0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7ff06150fde0>.

而且當下拉時,自動輪播到下一張圖片時,圖片的位置好像會偏移 在影片中可以觀察到下拉後圖片右側會顯示一點點下一張的圖

下拉放大效果的作法我是參照 http://blog.matthewcheok.com/design-teardown-stretchy-headers/

不知道這個問題是否有解呢? 如果需要源碼可以跟我說,我再傳給您參考 麻煩您了,謝謝

LvJianfeng commented 5 years ago

这个可能不适用你的需求哦~下拉过程中会修改控件的size导致的。 如果UICollectionView的size变了,那相应的UICollectionViewFlowLayout的也需要同时改变呢,不然就会发生约束错误呢。

applepeopletsai commented 5 years ago

了解,那我再想看看有沒有其他的解法 感謝您的回覆:)