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

How to add contentInset to scrollview / collectionview / calendar? #1418

Open
sebasdeweert opened this issue Oct 31, 2023 · 1 comment
Open

Comments

@sebasdeweert
Copy link

How can I add a contentInset to the calendar view?

I want to have an inset on the left and right sides.

Now, when I do this with constraints and I scroll the page, the calendar is cut off at the edge. I want to use contentInset to eliminate this edge and make the swipe smoother, utilizing the full-screen edges.

I tried this code, but it's not working:
self.calendar.collectionView.contentInset = UIEdgeInsets(top: 0.0, left: 40.0, bottom: 0.0, right: 40.0)

My calendar right now with constraint:

Screenshot 2023-10-31 at 17 41 57

What I would like to achieve:

Screenshot 2023-10-31 at 17 41 40

Thanks!!

@Dongju3079
Copy link

calendar.calendarWeekdayView.snp.makeConstraints { make in
make.horizontalEdges.equalToSuperview().inset(24)
make.height.equalTo(36)
}

calendar.collectionViewLayout.sectionInsets = .init(top: 5, left: 24, bottom: 5, right: 24)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants