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

Editable CalendarView (UICollectionView) Content Insets #332

Closed
iMacHumphries opened this issue Mar 4, 2017 · 13 comments
Closed

Editable CalendarView (UICollectionView) Content Insets #332

iMacHumphries opened this issue Mar 4, 2017 · 13 comments

Comments

@iMacHumphries
Copy link

I may be missing something obviously easy, but currently I cannot find a way to edit the underlying UICollectionView Insets. I am trying to make an offset for the scrollTo(date: ) function so that I can have a transparent Navigation Bar overtop of my calendar view.

Currently looks like this when I try to scroll to today's date:
image1

Trying to get it to look like this:
image2

I love your calendar! It is by far the best pod I have ever used, and it blows every other calendar pod out of the water!

Thanks for your help,
Ben

@patchthecode
Copy link
Owner

patchthecode commented Mar 4, 2017

Thank you for the compliment. I want it to be the best on github.

Concerning your issue.

  1. Confirming that you have vertical calendar?
  2. Which pod version are you using?
  3. Have you set a scrollingMode? Or are you using the default.
  4. Have you set an itemSize for the calendar?
  5. Are you using the calendar with a UINavigationController?

I need to know these information in order to replicate your issue.
The calendar should scroll to the date that you want. It should not be hidden behind a view.

@patchthecode patchthecode self-assigned this Mar 4, 2017
@iMacHumphries
Copy link
Author

  1. Yep!
  2. JTAppleCalendar (6.1.2)
  3. set to .none
  4. I set the itemSize = calendar.frame.size.width / 7 * 1.62
  5. Yep!

The calendar is setup through interface builder to be the exact same size as the view.

My calendar view is under my navigation bar on purpose (I like the translucent effect), and your calendar library is scrolling to the correct area if there were no navigation bar.

@iMacHumphries
Copy link
Author

it is important to note I have a custom sized navigation bar. I believe this is throwing off the automatic scroll view inset adjustment. I also believe if you allow us to edit the underlying collection view contentInsets that should fix the problem.

@patchthecode
Copy link
Owner

alright. I will look at this right now.
just awoke.

@patchthecode
Copy link
Owner

Just one thought have you tried unselecting this?
screen shot 2017-03-04 at 7 39 37 am

Click on the viewcontroller that contains the calendarView and unselect this.
Sometimes you maybe also need to unselect it on the parent view controllers of the view controller all the way up the stack. Can you test this and let me know?

@iMacHumphries
Copy link
Author

Hey that is a pretty good looking checkbox. I will check on that later today. Thanks for looking into this!

@patchthecode
Copy link
Owner

patchthecode commented Mar 4, 2017

By the way, your headers are always centered. Why not try making the header right above the first of the month like this -> #315
Just an idea. If not then is all good. 🍻

@iMacHumphries
Copy link
Author

iMacHumphries commented Mar 5, 2017

Okay so I tried the layout Adjust Scroll View Insets and It didn't change anything. Also, I have the header centered over the first day of the month, I just forgot to add layoutIfNeeded().

@iMacHumphries
Copy link
Author

iMacHumphries commented Mar 5, 2017

Okay so layout Adjust Scroll View Insets unchecked makes February (the first month) hidden under the nav bar and still does not fix scroll to date:

image1
(I scrolled to the very top in both images)

With the Adjust Scroll View Insets checked: (you can see feb)
image1

Regardless of Adjust Scroll View Insets checked or unchecked, scrolling to date yields:
image2

@iMacHumphries
Copy link
Author

By the way this calendar is for a workout app, and each number inside the circle represents how many pushups the user did today. Obviously I am pretty ripped since I totally did 263 pushups on Feb 23... ;P

@patchthecode
Copy link
Owner

patchthecode commented Mar 5, 2017

ok. This is happening because you have set your scrollMode to .none
It scrolled your date correctly. But the problem is the the library does not know that you have a UINavBar there. Hmm.. I i'm looking into the making the inset available as you have said.

Looking into it.

BTW, your design looks pretty neat. Have you done it with a class? or with a nib?

@iMacHumphries
Copy link
Author

iMacHumphries commented Mar 6, 2017

Thanks for looking into that for me. Insets may not fix my problem, may just need something like an offset to the scrollToDate or something like that.

The design uses nibs and is modeled after Apple's Activity app 😁.

@patchthecode
Copy link
Owner

OK, will work on this on the weekend. I should have an update for you by then.
I'll add an option to set an extra offset on the scrollToDate function

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