Permalink
Browse files

Moved the creation of the new clipview to the -contentView method as …

…a preventive measure.
  • Loading branch information...
1 parent d8dbe51 commit cc0d7607373c8bcb2463260d536a40c97a85ea22 @alexzielenski committed Nov 23, 2011
Showing with 21 additions and 10 deletions.
  1. +21 −10 ScrollToRefresh/src/EQSTRScrollView.m
@@ -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) {
@@ -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

0 comments on commit cc0d760

Please sign in to comment.