Skip to content

Commit

Permalink
Moved the creation of the new clipview to the -contentView method as …
Browse files Browse the repository at this point in the history
…a preventive measure.
  • Loading branch information
Alex Zielenski committed Nov 23, 2011
1 parent d8dbe51 commit cc0d760
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions ScrollToRefresh/src/EQSTRScrollView.m
Expand Up @@ -35,6 +35,24 @@ @implementation EQSTRScrollView
- (void)viewDidMoveToWindow {
[self createHeaderView];
}
- (NSClipView*)contentView {
NSClipView *superClipView = [super contentView];
if (![superClipView isKindOfClass:[EQSTRClipView class]]) {
// create new clipview
NSView *documentView = superClipView.documentView;

EQSTRClipView *clipView = [[EQSTRClipView alloc] initWithFrame:superClipView.frame];
clipView.documentView=documentView;
clipView.copiesOnScroll=NO;
clipView.drawsBackground=NO;
[self setContentView:clipView];

[clipView release];

superClipView = [super contentView];
}
return superClipView;
}
- (void)createHeaderView {
// delete old stuff if any
if (refreshHeader) {
Expand All @@ -45,18 +63,11 @@ - (void)createHeaderView {

[self setVerticalScrollElasticity:NSScrollElasticityAllowed];

// create new clipview
NSView *documentView = self.contentView.documentView;

EQSTRClipView *clipView = [[EQSTRClipView alloc] initWithFrame:self.contentView.frame];
clipView.documentView=documentView;
clipView.copiesOnScroll=NO;
clipView.drawsBackground=NO;
self.contentView=clipView;

[clipView release];
(void)self.contentView; // create new content view

[self.contentView setPostsFrameChangedNotifications:YES];
[self.contentView setPostsBoundsChangedNotifications:YES];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(viewBoundsChanged:)
name:NSViewBoundsDidChangeNotification
Expand Down

0 comments on commit cc0d760

Please sign in to comment.