Giter Site home page Giter Site logo

roberthein / bouncylayout Goto Github PK

View Code? Open in Web Editor NEW
4.2K 52.0 196.0 44.62 MB

Make. It. Bounce.

License: MIT License

Ruby 3.27% Objective-C 6.01% Swift 64.96% Makefile 25.76%
collection view layout uicollectionviewlayout bounce uikitdynamics spring springy bouncy uicollectionview

bouncylayout's Introduction

BouncyLayout is a collection view layout that makes your cells bounce.

Features

  • Pure Swift 5.
  • Works with every UICollectionView.
  • Horizontal and vertical scrolling support.
  • Configurable bounce effect.
  • Supports cell size changes

Setup

The only you thing you need to do is import BouncyLayout, create an instance and add it to your UICollectionView.

import BouncyLayout
let layout = BouncyLayout()
UICollectionView(frame: .zero, collectionViewLayout: layout)
Find the above displayed examples in the example folder.

Installation

CocoaPods

BouncyLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "BouncyLayout"

Carthage

BouncyLayout is available through Carthage. To install it, simply add the following line to your Cartfile:

github "roberthein/BouncyLayout"

Swift Package Manager

BouncyLayout is available through Swift Package Manager. To install it, in Xcode 11.0 or later select File > Swift Packages > Add Package Dependency... and add BouncyLayout repository URL:

https://github.com/roberthein/BouncyLayout.git

Suggestions or feedback?

Feel free to create a pull request, open an issue or find me on Twitter.

bouncylayout's People

Contributors

bobek-balinek avatar marcus433 avatar pacu avatar roberthein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bouncylayout's Issues

Does not respect Header Views

Hi, thanks for a great and very simple to implement feature. I have only one issue - I wish the have sections yet the section headers are not being respected.

With the following line implemented:

self.collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)

The CollectionView does not show my custom header view for each section.

ezgif com-video-to-gif

Without that line, the header is displayed fine.

ezgif com-video-to-gif 1

Any thoughts or suggestions? Kind regards

Doesn't work on 3x devices?

The demo works great on simulators and 2x scale devices but it looks strange on 3x devices. Any idea how to fix this?

Self resize cell messages

Your lib is so cool :))
I'm making a chat app and i dont know how to make cell message auto dimension (like tableview) with bouncy. Does you lib support or how i can archive that?
Thank you!

TableView

@roberthein Can this work with a tableview and if so, can you show me how I could implement it.

Inheritance?

Is it possible to subclass BouncyLayout? I have some custom behaviours I'd like to mix with BouncyLayout.

issue

If the framework can support is not equal to the height of the UICollectionViewCell and the cell containing the head trying to will be better ~ I have some problems with your framework~

Cell height not updating, when inserting new cell

I saved the heights of cells in data models and its working perfectly. When inserting a new cell, heights of visible cells are changed to next model. Again when the cells are scrolled out of view, and reenter then the are updated correctly. However default UICollectionViewFlowLayout has no issues.

Any reason why iOS 9 minimum

Most old project have iOS 8 minimum and no specific reason to change it. Is there any reason for this lib to be on minimum iOS 9 ?

Strange behaviour with grid example

Hi, nice layout !

I have an issue with the example on my iPhone SE and the grid exemple. In random scroll position cell start to make small circle animations on themselves often by group.

PS : I don't know how to provide you a gif of it I'd be glad to learn :) so you'll get a video
bugPhotoCell.mov.zip

Flipped CollectionView (Chat)

This pod looks great, super clean. I'm having an issue with a flipped collectionview and cell (chat app) though and not sure why.

I've tried both:

let layout = BouncyLayout()
collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView!.transform = CGAffineTransform.init(rotationAngle: (-(CGFloat)(Double.pi)))
// ...

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  // ...
  cell.transform = CGAffineTransform(rotationAngle: CGFloat.pi)
  return cell
}

and

let layout = BouncyLayout()
collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView!.transform = CGAffineTransform(a: 1, b: 0, c: 0, d: -1, tx: 0, ty: 0)
// ...

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  // ...
  cell.transform = collectionView.transform
  return cell
}

Both create different results. Any ideas? Thanks!

Crash when inserting cell

when the method insertItemsAtIndexPaths: is executed,the program crashes and prints the log:
no UICollectionViewLayoutAttributes instance for -layoutAttributesForItemAtIndexPath:

Layout does not maintain cell rotation.

I have a view that has rotated cells, simulating cards played out. the cells are rotated randomly:

if rotateCells {
            let randomInt = Int.random(in: -17..<18)
            cell.rotate(degrees: CGFloat(randomInt))        
}

When adding BouncyLayout - the cells don't maintain their rotation. I believe this is a bug...

Not working at all

I'm using like this:
self.collectionView.collectionViewLayout = BouncyLayout()

Please help me if I'm wrong somewhere.
Thanks!

Pod not working

This is my podfile look like

use_frameworks!
pod 'BouncyLayout'

when i install my pod it throws error like:

Analyzing dependencies
[!] Unable to find a specification for `BouncyLayout`

Strange behaviour with Chat type

It continuously animating with circular motion.(In iPhone X)
When return cell size (in layout delegate method) 'CGSize(width: collectionView.frame.width, height: 40)' or
'CGSize(width: collectionView.frame.width - "anyEvenNumber", height: 40)

But it work for CGSize(width: collectionView.frame.width - "anyOddNumber", height: 40)

BouncyLayout for UITableView

Hi @roberthein,
I really love BouncyLayout and have used it for a few of my collection views so far which has worked well. However, I have three UITableViews which should stay tableviews due to some autoresizing issues with UICollectionView even a colleague of mine who is quite experienced at coding was not able to solve. Therefore, I was wondering whether there was a way to use this library on a tableview as I couldn't figure one out.
Would really appreciate your help!
blurtime

Objective-C

is there a way to convert it or use it by objective-c?

Introducing new APIs

Hi,
an enhancement will be the ability to modify the damping and the frequency property of the animator. What do you think about it?

Matteo

Overlapping Cells

I'm using BouncyLayout horizontally, and find that the spacing between each cell compresses far too much, causing an overlap.

Is there a way to avoid compression altogether and have the cells kind of bump of against each other?

Unable to install via pod

I'm trying to install through pod, it show following error in terminal:
Unable to find a specification for BouncyLayout

Changing UITraitCollection causes display glitches

Hi! Great library :)

Not sure if this is iPad specific, but when the UITraitCollection is changed (e.g. display is rotated, OR if you adjust the size of the app in SplitView to name a couple of ways), it throws off the UICollectionView and requires you to scroll down and then back up to have it reload those rows.

IMG_1986
IMG_1987
IMG_1988

Any advice would be appreciated! 😄

macOS Support?

I really like this lib, and I want to use it in my chat app. But it is a macOS app, so I want to know, are there any plans on supporting macOS in the future?

How To Use This With JSQ

Is This compatible with JSQ . I know JSQ is Deprecated. but i dont want to convert my whole project . how can i use this with JSQ

Pixel jitter when animation comes to rest

There's a 1px left-right-jitter glitch happening on the moved items when the animation settles down. They are already at their destination, but glitching a bit to the left and to the right until they finally stop. I'm pretty sure this is happening, because the spring is still oscillating, but the values become too small to render (< 1px) causing it to look like a bug.
You can actually see that behavior in the demo gif in the README.

Any ideas how this could be fixed? I was thinking of a custom Dynamic Item or Behavior, but perhaps there's a simpler approach. Help is greatly appreciated!

Bugalicious

There are so many things that don't work with this library.

  • UICollectionReusableViews
  • HeaderReferenceSize isn't respected.
  • Bounce animations on simulator are completely off. (most like apple issue. works on device).
  • CollectionViewHeaders just vanish out of thin air
  • CollectionViewHeaders height are adjusted incorrectly on scroll.
  • Imageviews in cells just disappear on touch.

The list goes on.

Support for self-sizing cells

Hi there, good job on this project, it looks really cool and I am looking forward to using it.

I tried to use it with my collection view in which I’m using self-sizing cells, simply droppping in BouncyLayout() in place of the existing UICollectionViewFlowLayout(), and setting a random .estimatedItemSize before assigning it to the collection view. The self-sizing behaviour doesn’t remain, however, and the cells all get resized to a fixed size.

My project is currently in a haphazard state so I can’t upload the code; however I’m using IGListKit and was able to reproduce this effect with their provided self-sizing cells example.

Do you plan on adding support for self-sizing cells to BouncyLayout? The Instagram people themselves had a bunch of issues with implementing it, so I would understand if you don’t plan on doing so; their codebase would be a great help if you did, however.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.