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

KKGridView slow #154

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
14 changes: 7 additions & 7 deletions KKGridView/KKGridView.m
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ - (void)_layoutSectionViews
CGFloat offset = self.contentOffset.y + self.contentInset.top;

// If the user is providing titles, they want the default look.
static UIImage *headerBackgrounds[2] = {0};
static UIColor *headerBackgrounds[2] = {0};

if (_dataSourceRespondsTo.titleForHeader || _dataSourceRespondsTo.titleForFooter) {
static dispatch_once_t onceToken;
Expand All @@ -517,8 +517,8 @@ - (void)_layoutSectionViews
return [UIImage imageWithContentsOfFile:[bundle pathForResource:n ofType:@"png"]];
};

headerBackgrounds[0] = getBundleImage(@"UISectionListHeaderBackground");
headerBackgrounds[1] = getBundleImage(@"UISectionListHeaderBackgroundOpaque");
headerBackgrounds[0] = [UIColor colorWithPatternImage:getBundleImage(@"UISectionListHeaderBackground")];
headerBackgrounds[1] = [UIColor colorWithPatternImage:getBundleImage(@"UISectionListHeaderBackgroundOpaque")];
});
}

Expand All @@ -533,7 +533,7 @@ - (void)_layoutSectionViews
headerFrame.origin.y = offset;

if (_dataSourceRespondsTo.titleForHeader)
header.view.backgroundColor = [UIColor colorWithPatternImage:headerBackgrounds[1]];
header.view.backgroundColor = headerBackgrounds[1];

KKGridViewHeader *sectionTwo = [_headerViews count] > header->section + 1 ? [_headerViews objectAtIndex:header->section + 1] : nil;
if (sectionTwo != nil) {
Expand All @@ -548,7 +548,7 @@ - (void)_layoutSectionViews
// Put header back to default position
headerFrame.origin.y = header->stickPoint;
if (_dataSourceRespondsTo.titleForHeader)
header.view.backgroundColor = [UIColor colorWithPatternImage:headerBackgrounds[0]];
header.view.backgroundColor = headerBackgrounds[0];
}

header.view.frame = headerFrame;
Expand Down Expand Up @@ -584,15 +584,15 @@ - (void)_layoutSectionViews
}

if (_dataSourceRespondsTo.titleForFooter)
footer.view.backgroundColor = [UIColor colorWithPatternImage:headerBackgrounds[0]];
footer.view.backgroundColor = headerBackgrounds[0];

// move footer view to right below scroller
[footer.view removeFromSuperview];
[self _insertSubviewBelowScrollbar:footer.view];

} else {
if (_dataSourceRespondsTo.titleForFooter)
footer.view.backgroundColor = [UIColor colorWithPatternImage:headerBackgrounds[0]];
footer.view.backgroundColor = headerBackgrounds[0];

// footer isn't sticky anymore, set originTop to saved position
f.origin.y = footer->stickPoint;
Expand Down