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

Manipulating another cell #54

Closed
hanishassim opened this issue Jun 24, 2016 · 18 comments
Closed

Manipulating another cell #54

hanishassim opened this issue Jun 24, 2016 · 18 comments
Labels

Comments

@hanishassim
Copy link

I was just wondering if it is possible to manipulate another cell when the user tap a cell.
For example, when I tap 24 June cell, it will then change the cell for date 28, 29, 30th June also.
If its possible could you shed some light on how to achieve this?

@patchthecode
Copy link
Owner

When you say "change the cell", do you mean changing their selection state?

@hanishassim
Copy link
Author

Yes, its okay, I found the way to do it (but I'm not sure if this is the best way? hmm):
Each time a date is selected (allowsMultipleSelection = true) the calendar view will reloadDates() the selected dates to re-manipulate each of the dates
The problem now is there is some kind of tranisition lag when reloading the cells again you can see from the GIf below:
out
I doubt this is the best way cause of the lag effect...

@patchthecode
Copy link
Owner

Ok, i see, youre trying to implement range selection. This is a feature i am currently working on. It will be done in such a way that the user can drag select their dates.

I like that you are doing awesome things with this calendar. But its difficult for me to know what youre doing to generate those views without seeing any code. But I do understand that that your project is sensitive.

So here are our options. You can do any one of the following.

  1. You can create a non-sensitive version of your code that only has the selection bug code. The selection code is not sensitive stuff.
  2. Or you can dig into the library yourself, because since I'm the sole developer, i have time constraints. Here is where I would begin looking for clues:

a) Does calendarView.reloadData have the same visual bug as calendarView.reloadDates() ?
b) In the JTAppleCalendar library, there is a file called UserInteractionFunctions.swift. This is where I put all functions that users like you use to interact with the calendar. Go to the reloadDates() function.
It should look like this:

reloadIndexPathsIfVisible(pathsFromDates(dates))

we are reloading some IndexPaths from the dates you have provided if they are visible on the screen. Can you change the code to the following and repeat (a) and (b) above ?

        delayRunOnGlobalThread(0.0, qos: QOS_CLASS_USER_INITIATED) { 
            let allPathsFromDates = self.pathsFromDates(dates)
            self.reloadIndexPathsIfVisible(allPathsFromDates)
        }

Let me know if you have done anything to fix it. Let's make this library even better.

@hanishassim
Copy link
Author

hanishassim commented Jun 24, 2016

Thanks you are very helpful, I appreciate that.
I have tried the option above but nothing changes, its still happening

So I proceed by creating the non-sensitive code of the calendar, I hope that once you download it you would remove it from this list.
[edit removed]

PS: Sorry in advance if my code is messy and not correctly implemented, I'm still learning.

@patchthecode
Copy link
Owner

patchthecode commented Jun 24, 2016

Btw, if you have things you dont want posted here, you can always ask for my email.
patchthecode@gmail.com

Taking a look at your work now.

@patchthecode
Copy link
Owner

I think ive found the reason for the slow animation. Working on a fix.

@patchthecode
Copy link
Owner

Hey, i just uploaded the fix to the master branch. How soon are you able to test it?

@hanishassim
Copy link
Author

Hi, thanks. I will test it right away..

@patchthecode
Copy link
Owner

To test the master branch with your current project do this:

Go to your pod file, and change your JTAppleCalendar pod to this:

pod 'JTAppleCalendar', :git => 'https://github.com/patchthecode/JTAppleCalendar.git', :commit => '591e744adadec1ed69bf5318e3e9c5e46dc6dd3f'

Then do a:

pod install

This will let you use the latest code. Try it out and let me know

@hanishassim
Copy link
Author

I tested with the new release with my code untouched and what happen is after I selected a cell, I can't deselect it back, and the state of the cell stays selected, I did print out the selected dates (on the console) to verify this.

@patchthecode
Copy link
Owner

Are you online now? Can you join me here? --> https://gitter.im/patchthecode/JTAppleCalendar

@hanishassim
Copy link
Author

Issue solved.

@patchthecode
Copy link
Owner

Hey I have one other question for you:

I was going to implement a range selection feature for this calendar.
But since your project has done so already, Do you think this is a feature that will be needed on my end?

I wanted to do it, but if this calendar is already flexible enough that users can already do range selection, then do you think that it is needed from my end? or not?

I will decide whether or not to make it based on your answer to this question:

Is it easy for you to implement a tap-> and slide -> to select dates?
Tap and slide means, a user can tap, then without lifting their finger, they can slide and select multiple dates

Is this possible to do with your app easily? Or is there something this library can do to make this easier?

@hanishassim
Copy link
Author

I haven't tried out the tap and slide before, but its going to be a nice feature. I could try to implement it and see how beneficial it brings to my project in particular.. If you can wait I can try and send you feedback on whether it is easy (successfully) or not to implement it..

But generally speaking, this is related to the library, and I myself think it is a great feature to have

@patchthecode
Copy link
Owner

patchthecode commented Jul 10, 2016

Well that's the thing. Its meant to be a library. It's meant to enable a dev to build the feature him self if needed. Think about the UITableView, Apple makes it very simple and flexibly. It does not have things like range selection, but this can then be built by the developer.

So let me know how difficult it is, to implement. (if you're taking a while to implement it then I might just do it to see my self)

But on the whole,
I think that tapping and sliding across to multi-select dates seem more natural than single tapping.

I will think about it if you're busy with your project and are taking a while to implement.

@patchthecode
Copy link
Owner

Haha, it seems that since you have put up that range selection, many people are asking me how to implement it >_<

@patchthecode
Copy link
Owner

I just added Range selection to master branch.
FYI

@hanishassim
Copy link
Author

Hey, sorry for late reply.
Noted and thanks.

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

No branches or pull requests

2 participants