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

cells loads multiple times while it's visible if you scroll fast many times. #137

Closed
IsmailHassanein opened this issue Nov 3, 2015 · 7 comments

Comments

@IsmailHassanein
Copy link

while paging is off when I scroll quickly from Jan 2013 to Dec 2022 on iPad 2, I've saw the cells tiltes keep changing many times quickly for about 2 seconds. I got a chance to take a screenshot of it.

If you see the first shot you will find the numbers is wrong and even has duplicate berfore it tured to the correct numbers(in the second shot).
img_0004
img_0005

@IsmailHassanein IsmailHassanein changed the title cells loads multiple times while it's visible if you scroll fast maytimes. cells loads multiple times while it's visible if you scroll fast manytimes. Nov 3, 2015
@IsmailHassanein IsmailHassanein changed the title cells loads multiple times while it's visible if you scroll fast manytimes. cells loads multiple times while it's visible if you scroll fast many times. Nov 3, 2015
@WenchaoD
Copy link
Owner

WenchaoD commented Nov 4, 2015

The data of the cells are loaded asyncronously for a better scrolling performance, didn't expect this side effect happen. Let me think this over...

@WenchaoD
Copy link
Owner

WenchaoD commented Nov 4, 2015

BTW. Which system version? 7+,8+,or 9+

@IsmailHassanein
Copy link
Author

iPad 2 iOS 8.4.1
I see the asynchronous loading. I think it's a good idea. I think you need to keep track of the cell you loading if it's not visible or dequeued for diffrenet indexPath you should discard this loading.

@WenchaoD
Copy link
Owner

WenchaoD commented Nov 4, 2015

Try this?

@IsmailHassanein
Copy link
Author

It's Woking good. Btw, The memoery usage has been droped alot too 👍 .

@WenchaoD
Copy link
Owner

WenchaoD commented Nov 4, 2015

Looks today is really my day. Thanks.

@WenchaoD WenchaoD closed this as completed Nov 4, 2015
@WenchaoD
Copy link
Owner

WenchaoD commented Nov 7, 2015

Hi @Ishass
I realized today that there are other important reasons for the bad performance.

  1. I shoundn't use self.selectedDates inside FSCalendar.m because everytime it's been called, a new NSArray instance will be created. It's somehow necessary because if not, when enumerating calendar.selectedDates and deselect dates, it cause inserting and deleting issue for Array. Now I've changed the usage inside FSCalendar.m to _selectedDates, it performs better.
  2. The NSDate+FSExtension.h uses NSDateFormatter many times, and the old way is to create NSDateFormatter every time, that's another reason that cause bad scrolling performace.

Now that the asyncrous property might not be required anymore. I've pushed the commits into 1.6.3. You'd like to try this?

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