Skip to content

Commit

Permalink
Cleaned house, added blocks instead of targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Zielenski committed Apr 6, 2012
1 parent cc0d760 commit fde84cd
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 129 deletions.
24 changes: 1 addition & 23 deletions ScrollToRefresh.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
FA121D851472FB9300FED3BA /* EQSTRClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = FA121D841472FB9300FED3BA /* EQSTRClipView.m */; };
FA121D87147303B400FED3BA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA121D86147303B400FED3BA /* QuartzCore.framework */; };
FA121D89147303EC00FED3BA /* arrow.png in Resources */ = {isa = PBXBuildFile; fileRef = FA121D88147303EC00FED3BA /* arrow.png */; };
FA121D951473074D00FED3BA /* YRKSpinningProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = FA121D941473074D00FED3BA /* YRKSpinningProgressIndicator.m */; };
FA121D97147318BD00FED3BA /* README.markdown in Resources */ = {isa = PBXBuildFile; fileRef = FA121D96147318BD00FED3BA /* README.markdown */; };
/* End PBXBuildFile section */

Expand All @@ -41,8 +40,6 @@
FA121D841472FB9300FED3BA /* EQSTRClipView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EQSTRClipView.m; path = src/EQSTRClipView.m; sourceTree = "<group>"; };
FA121D86147303B400FED3BA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
FA121D88147303EC00FED3BA /* arrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = arrow.png; sourceTree = "<group>"; };
FA121D931473074D00FED3BA /* YRKSpinningProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YRKSpinningProgressIndicator.h; sourceTree = "<group>"; };
FA121D941473074D00FED3BA /* YRKSpinningProgressIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YRKSpinningProgressIndicator.m; sourceTree = "<group>"; };
FA121D96147318BD00FED3BA /* README.markdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.markdown; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -103,7 +100,6 @@
FA121D721472FB2B00FED3BA /* EQSTRAppDelegate.m */,
FA121D7F1472FB5C00FED3BA /* ScrollToRefresh */,
FA121D741472FB2B00FED3BA /* MainMenu.xib */,
FA121D8A147306C100FED3BA /* 3rd Party */,
FA121D661472FB2B00FED3BA /* Supporting Files */,
);
path = ScrollToRefresh;
Expand Down Expand Up @@ -134,24 +130,6 @@
name = ScrollToRefresh;
sourceTree = "<group>";
};
FA121D8A147306C100FED3BA /* 3rd Party */ = {
isa = PBXGroup;
children = (
FA121D921473074D00FED3BA /* YRKSpinningProgressIndicator */,
);
name = "3rd Party";
path = "src/3rd Party";
sourceTree = "<group>";
};
FA121D921473074D00FED3BA /* YRKSpinningProgressIndicator */ = {
isa = PBXGroup;
children = (
FA121D931473074D00FED3BA /* YRKSpinningProgressIndicator.h */,
FA121D941473074D00FED3BA /* YRKSpinningProgressIndicator.m */,
);
path = YRKSpinningProgressIndicator;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -222,7 +200,6 @@
FA121D731472FB2B00FED3BA /* EQSTRAppDelegate.m in Sources */,
FA121D7E1472FB5800FED3BA /* EQSTRScrollView.m in Sources */,
FA121D851472FB9300FED3BA /* EQSTRClipView.m in Sources */,
FA121D951473074D00FED3BA /* YRKSpinningProgressIndicator.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -342,6 +319,7 @@
FA121D7B1472FB2B00FED3BA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
10 changes: 5 additions & 5 deletions ScrollToRefresh/src/EQSTRClipView.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ @implementation EQSTRClipView
- (NSPoint)constrainScrollPoint:(NSPoint)proposedNewOrigin { // this method determines the "elastic" of the scroll view or how high it can scroll without resistence.
NSPoint constrained = [super constrainScrollPoint:proposedNewOrigin];
CGFloat scrollValue = proposedNewOrigin.y; // this is the y value where the top of the document view is
BOOL over = scrollValue<=self.minimumScroll;
BOOL over = scrollValue <= self.minimumScroll;

if (self.isRefreshing&&scrollValue<=0) { // if we are refreshing
if (self.isRefreshing && scrollValue <= 0) { // if we are refreshing
if (over) // and if we are scrolled above the refresh view
proposedNewOrigin.y = 0-self.headerView.frame.size.height; // constrain us to the refresh view
proposedNewOrigin.y = 0 - self.headerView.frame.size.height; // constrain us to the refresh view
return NSMakePoint(constrained.x, proposedNewOrigin.y);
}
return constrained;
Expand All @@ -45,8 +45,8 @@ - (BOOL)isFlipped {
- (NSRect)documentRect { //this is to make scrolling feel more normal so that the spinner is within the scrolled area
NSRect sup = [super documentRect];
if (self.isRefreshing) {
sup.size.height+=self.headerView.frame.size.height;
sup.origin.y-=self.headerView.frame.size.height;
sup.size.height += self.headerView.frame.size.height;
sup.origin.y -= self.headerView.frame.size.height;
}
return sup;
}
Expand Down
23 changes: 4 additions & 19 deletions ScrollToRefresh/src/EQSTRScrollView.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,16 @@

#import <AppKit/AppKit.h>

@interface EQSTRScrollView : NSScrollView {
BOOL isRefreshing;
BOOL overHeaderView;

NSView *refreshHeader;
NSView *refreshArrow;
NSProgressIndicator *refreshSpinner;

id target;
SEL selector;
}
@property (assign) id target;
@property (assign) SEL selector;

@interface EQSTRScrollView : NSScrollView
@property (readonly) BOOL isRefreshing;

@property (readonly) NSView *refreshHeader;
@property (readonly) NSProgressIndicator *refreshSpinner;
@property (readonly) NSView *refreshArrow;

@property (nonatomic, copy) void (^refreshBlock)(EQSTRScrollView *scrollView);

- (void)startLoading;
- (void)stopLoading;

- (BOOL)overRefreshView;
- (void)createHeaderView;
- (void)viewBoundsChanged:(NSNotification*)note;

- (CGFloat)minimumScroll;
@end
Loading

0 comments on commit fde84cd

Please sign in to comment.