Jtapplecalendar: Resize Calendar View without redrawing/resetting/reloading data.

Created on 29 Nov 2017  ·  7Comments  ·  Source: patchthecode/JTAppleCalendar

I'm the same project as previously closed issue 627.

Is there a way I can resize the calendarView, without changing the size of any of the underlying collection view cells, without the entire calendarView redrawing and resetting?

I have my calendar view in a split view next to a task list and from time to time the user will want to shrink or collapse the task list to get a better view of the calendar. It will be more user friendly if I can "freeze" the calendar view in place during resize operation. Make sense?

question

Most helpful comment

it worked. Just had to rejigger some hit tests and constraints. Thanks.

All 7 comments

Ok, will check it out some more over the weekend.
I got a busy recently.

ok finally have a chance to get a good look at the question.
so when you shrink the calendar's frame, I understand that you do not want the calendar's cells to resize.

So can you explain how do you want the calendar to respond?
When the calendar's frame shrinks, you want the cells width/height to stay the same? This is the part i am unclear on.

I'll show screen shots it might be easier.

So I have the JTAppleCalendar in a container view, and I use it to schedule assignments for an education app by dragging and dropping from a tableview. Problem is that when i resize the container view it always redraws the calendar which is an imperfect experience.

All I want to do is NOT redraw the calendar when i resize the container view. This would be possible in a regular collection view as long as the contentSize is larger than the screen size. I'm guessing it might have something to do with ViewWillLayoutSubviews being called on the superview resize but I'm not 100% sure. Make sense?

Before resize:
_(Content Offset 600px / One month)_

q2a

After resize:
_(Content Offset 0px) but should be 600px_

Calendar redrew and scrolled up to contentOffset = 0 when I want it to stay at 600px

q2b

hmm. a long time ago, i propably thought about this feature.

calendarView.allowsDateCellStretching = false

but since no one asked for it, I do not think i finished implementing it.
I can take a look to try. But this wont be completed soon as I am on other projects for a short while.

What you can do as a workaround is something like what this guy did with his JTAppleCalendar -> https://github.com/patchthecode/WLAppleCalendar

In his gif image you can see the calendar "resizing" and the cells are not redrawn.
How did he do it?

The bottom tableView is Above the calendar view. It has a NSLayoutConstraint set to the top of the viewController. Then he adjusts the size of that constraint to hide bottom portions of the calendar when needed. Can this technique word for you?

Its because of techniques like these that i think calendarView.allowsDateCellStretching = false might be unneeded. Let me know if this works for you.

Ill try that. Itll take some hit test rejiggering but it might work. I'll let you know how it turns out.

awesome. cool

it worked. Just had to rejigger some hit tests and constraints. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prahaladm picture prahaladm  ·  3Comments

Kevinw14 picture Kevinw14  ·  3Comments

zhanswift picture zhanswift  ·  5Comments

programus picture programus  ·  5Comments

PedroAnibarro1 picture PedroAnibarro1  ·  5Comments