Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spacing Betwens Items #258

Closed
johnharutyunyan opened this issue Apr 15, 2020 · 3 comments
Closed

Spacing Betwens Items #258

johnharutyunyan opened this issue Apr 15, 2020 · 3 comments
Milestone

Comments

@johnharutyunyan
Copy link

Hello , guys.
Is it possible to have space between items ?
Can I have different spacing between
From Action Button and First Item - 30,
after First Item spacing - 15

@jjochen
Copy link
Owner

jjochen commented Apr 17, 2020

Configuring the space between items is fairly simple:

        actionButton.itemAnimationConfiguration = .popUp(withInterItemSpacing: 15)

A different spacing for the first item is a bit more complicated at the moment and should probably be easier (I'll make it configurable #262).

        let configuration = JJItemAnimationConfiguration()
        configuration.itemLayout = JJItemLayout { items, actionButton in
            var previousItem: JJActionItem?
            for item in items {
                let previousView = previousItem ?? actionButton
                let spacing: CGFloat = previousItem == nil ? 60 : 15
                item.bottomAnchor.constraint(equalTo: previousView.topAnchor, constant: -spacing).isActive = true
                item.circleView.centerXAnchor.constraint(equalTo: actionButton.centerXAnchor).isActive = true
                previousItem = item
            }
        }
        configuration.closedState = .scale()
        actionButton.itemAnimationConfiguration = configuration

And I'm realizing now that some methods in there are not public. I will fix that as soon as possible (#259)

@jjochen
Copy link
Owner

jjochen commented Apr 18, 2020

This should be easier with version 2.5.0

actionButton.itemAnimationConfiguration = .popUp(withInterItemSpacing: 15, firstItemSpacing: 30)

@jjochen jjochen removed the support label Apr 18, 2020
@jjochen jjochen added this to the 2.5.0 milestone Apr 18, 2020
@jjochen
Copy link
Owner

jjochen commented Apr 18, 2020

I will close this now. If you have more questions feel free to reopen it.

@jjochen jjochen closed this as completed Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants