Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

blah

  • Loading branch information...
commit 159ad32164ab205069c51f3aeb8cb6baca4da94e 1 parent 8123fa4
@alexzielenski authored
View
2  README.markdown
@@ -2,6 +2,8 @@ Introduction
================
ScrollToRefresh is a subclass of NSScrollView that adds a "pull-to-refresh" feel to the "elastic" area of NSScrollview.
+![ScrollToRefresh in action](http://cl.ly/Bq18/Screen%20Shot%202011-11-15%20at%205.04.57%20PM.png "Scroll To Refresh")
+
How it works
================
The secret is actually knowing how scroll views work. When you scroll, the clip view offsets the origin of its `-bounds` so any subview within the clipview will scroll. It also employs a couple of other methods to check the boundaries of the document view which I override to include the refresh view to get a more natural feel.
View
61 ScrollToRefresh.xcodeproj/project.pbxproj
@@ -13,6 +13,12 @@
FA121D701472FB2B00FED3BA /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = FA121D6E1472FB2B00FED3BA /* Credits.rtf */; };
FA121D731472FB2B00FED3BA /* EQSTRAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FA121D721472FB2B00FED3BA /* EQSTRAppDelegate.m */; };
FA121D761472FB2B00FED3BA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA121D741472FB2B00FED3BA /* MainMenu.xib */; };
+ FA121D7E1472FB5800FED3BA /* EQSTRScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = FA121D7D1472FB5800FED3BA /* EQSTRScrollView.m */; };
+ 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 */
/* Begin PBXFileReference section */
@@ -21,14 +27,23 @@
FA121D621472FB2B00FED3BA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
FA121D631472FB2B00FED3BA /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
FA121D641472FB2B00FED3BA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
- FA121D671472FB2B00FED3BA /* ScrollToRefresh-Info.plist */ = {isa = PBXFileReference; path = "ScrollToRefresh-Info.plist"; sourceTree = "<group>"; };
+ FA121D671472FB2B00FED3BA /* ScrollToRefresh-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ScrollToRefresh-Info.plist"; sourceTree = "<group>"; };
FA121D691472FB2B00FED3BA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
FA121D6B1472FB2B00FED3BA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- FA121D6D1472FB2B00FED3BA /* ScrollToRefresh-Prefix.pch */ = {isa = PBXFileReference; path = "ScrollToRefresh-Prefix.pch"; sourceTree = "<group>"; };
+ FA121D6D1472FB2B00FED3BA /* ScrollToRefresh-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ScrollToRefresh-Prefix.pch"; sourceTree = "<group>"; };
FA121D6F1472FB2B00FED3BA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
- FA121D711472FB2B00FED3BA /* EQSTRAppDelegate.h */ = {isa = PBXFileReference; path = EQSTRAppDelegate.h; sourceTree = "<group>"; };
+ FA121D711472FB2B00FED3BA /* EQSTRAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQSTRAppDelegate.h; sourceTree = "<group>"; };
FA121D721472FB2B00FED3BA /* EQSTRAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQSTRAppDelegate.m; sourceTree = "<group>"; };
FA121D751472FB2B00FED3BA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ FA121D7C1472FB5800FED3BA /* EQSTRScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EQSTRScrollView.h; path = src/EQSTRScrollView.h; sourceTree = "<group>"; };
+ FA121D7D1472FB5800FED3BA /* EQSTRScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EQSTRScrollView.m; path = src/EQSTRScrollView.m; sourceTree = "<group>"; };
+ FA121D831472FB9300FED3BA /* EQSTRClipView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EQSTRClipView.h; path = src/EQSTRClipView.h; sourceTree = "<group>"; };
+ 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 */
/* Begin PBXFrameworksBuildPhase section */
@@ -36,6 +51,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ FA121D87147303B400FED3BA /* QuartzCore.framework in Frameworks */,
FA121D601472FB2B00FED3BA /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -63,6 +79,7 @@
FA121D5E1472FB2B00FED3BA /* Frameworks */ = {
isa = PBXGroup;
children = (
+ FA121D86147303B400FED3BA /* QuartzCore.framework */,
FA121D5F1472FB2B00FED3BA /* Cocoa.framework */,
FA121D611472FB2B00FED3BA /* Other Frameworks */,
);
@@ -84,7 +101,9 @@
children = (
FA121D711472FB2B00FED3BA /* EQSTRAppDelegate.h */,
FA121D721472FB2B00FED3BA /* EQSTRAppDelegate.m */,
+ FA121D7F1472FB5C00FED3BA /* ScrollToRefresh */,
FA121D741472FB2B00FED3BA /* MainMenu.xib */,
+ FA121D8A147306C100FED3BA /* 3rd Party */,
FA121D661472FB2B00FED3BA /* Supporting Files */,
);
path = ScrollToRefresh;
@@ -93,15 +112,46 @@
FA121D661472FB2B00FED3BA /* Supporting Files */ = {
isa = PBXGroup;
children = (
+ FA121D88147303EC00FED3BA /* arrow.png */,
FA121D671472FB2B00FED3BA /* ScrollToRefresh-Info.plist */,
FA121D681472FB2B00FED3BA /* InfoPlist.strings */,
FA121D6B1472FB2B00FED3BA /* main.m */,
FA121D6D1472FB2B00FED3BA /* ScrollToRefresh-Prefix.pch */,
FA121D6E1472FB2B00FED3BA /* Credits.rtf */,
+ FA121D96147318BD00FED3BA /* README.markdown */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
+ FA121D7F1472FB5C00FED3BA /* ScrollToRefresh */ = {
+ isa = PBXGroup;
+ children = (
+ FA121D7C1472FB5800FED3BA /* EQSTRScrollView.h */,
+ FA121D7D1472FB5800FED3BA /* EQSTRScrollView.m */,
+ FA121D831472FB9300FED3BA /* EQSTRClipView.h */,
+ FA121D841472FB9300FED3BA /* EQSTRClipView.m */,
+ );
+ 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 */
@@ -156,6 +206,8 @@
FA121D6A1472FB2B00FED3BA /* InfoPlist.strings in Resources */,
FA121D701472FB2B00FED3BA /* Credits.rtf in Resources */,
FA121D761472FB2B00FED3BA /* MainMenu.xib in Resources */,
+ FA121D89147303EC00FED3BA /* arrow.png in Resources */,
+ FA121D97147318BD00FED3BA /* README.markdown in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -168,6 +220,9 @@
files = (
FA121D6C1472FB2B00FED3BA /* main.m in Sources */,
FA121D731472FB2B00FED3BA /* EQSTRAppDelegate.m in Sources */,
+ FA121D7E1472FB5800FED3BA /* EQSTRScrollView.m in Sources */,
+ FA121D851472FB9300FED3BA /* EQSTRClipView.m in Sources */,
+ FA121D951473074D00FED3BA /* YRKSpinningProgressIndicator.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
7 ScrollToRefresh.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:ScrollToRefresh.xcodeproj">
+ </FileRef>
+</Workspace>
View
BIN  ....xcodeproj/project.xcworkspace/xcuserdata/Alex.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
5 ScrollToRefresh.xcodeproj/xcuserdata/Alex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+ type = "1"
+ version = "1.0">
+</Bucket>
View
84 ScrollToRefresh.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/ScrollToRefresh.xcscheme
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "FA121D5A1472FB2B00FED3BA"
+ BuildableName = "ScrollToRefresh.app"
+ BlueprintName = "ScrollToRefresh"
+ ReferencedContainer = "container:ScrollToRefresh.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "FA121D5A1472FB2B00FED3BA"
+ BuildableName = "ScrollToRefresh.app"
+ BlueprintName = "ScrollToRefresh"
+ ReferencedContainer = "container:ScrollToRefresh.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "FA121D5A1472FB2B00FED3BA"
+ BuildableName = "ScrollToRefresh.app"
+ BlueprintName = "ScrollToRefresh"
+ ReferencedContainer = "container:ScrollToRefresh.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "FA121D5A1472FB2B00FED3BA"
+ BuildableName = "ScrollToRefresh.app"
+ BlueprintName = "ScrollToRefresh"
+ ReferencedContainer = "container:ScrollToRefresh.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
View
22 ScrollToRefresh.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>SchemeUserState</key>
+ <dict>
+ <key>ScrollToRefresh.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>FA121D5A1472FB2B00FED3BA</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
View
22 ScrollToRefresh/EQSTRAppDelegate.h
@@ -2,14 +2,30 @@
// EQSTRAppDelegate.h
// ScrollToRefresh
//
-// Created by Alex Zielenski on 11/15/11.
-// Copyright (c) 2011 Alex Zielenski. All rights reserved.
+// Copyright (C) 2011 by Alex Zielenski.
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
#import <Cocoa/Cocoa.h>
@interface EQSTRAppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
-
+- (IBAction)stopRefreshing:(NSButton*)sender;
@end
View
26 ScrollToRefresh/EQSTRAppDelegate.m
@@ -2,11 +2,29 @@
// EQSTRAppDelegate.m
// ScrollToRefresh
//
-// Created by Alex Zielenski on 11/15/11.
-// Copyright (c) 2011 Alex Zielenski. All rights reserved.
+// Copyright (C) 2011 by Alex Zielenski.
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
#import "EQSTRAppDelegate.h"
+#import "EQSTRScrollView.h"
@implementation EQSTRAppDelegate
@@ -21,5 +39,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
}
-
+- (IBAction)stopRefreshing:(NSButton*)sender {
+ [(EQSTRScrollView*)sender.enclosingScrollView stopLoading];
+}
@end
Please sign in to comment.
Something went wrong with that request. Please try again.