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

leave one cell in quiltView #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion TMQuiltView/TMQuiltView/TMQuiltView.m
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ - (void)layoutSubviews {
// Harvest any any views that have moved off screen and add them to the reuse pool
for (NSIndexPath* indexPath in [indexPathToView allKeys]) {
TMQuiltViewCell *view = [indexPathToView objectForKey:indexPath];
if (![TMQuiltView isRect:view.frame partiallyInScrollView:self]) { // Rect intersection?
// the indexPathToView must has one indexPath,we should not remove all cell in quiltView,
// if *top == *bottom ,there is one cell in quitView ,so at this time,cell can not be removed
if (![TMQuiltView isRect:view.frame partiallyInScrollView:self] && indexPathToView.count > 1) { // Rect intersection?
[indexPathToView removeObjectForKey:indexPath];
// Limit the size on the reuse pool
if ([[self reusableViewsWithReuseIdentifier:view.reuseIdentifier] count] < 10) {
Expand Down