Skip to content
Browse files

Updated to demonstrate scrolling restart after user interaction.

  • Loading branch information...
1 parent 50caa94 commit a8ed6c7376a1934a4ce5f86edcaef3ceb4614fa5 @danielamitay committed Mar 16, 2012
View
BIN DAAutoScrollExample/.DS_Store
Binary file not shown.
View
9 DAAutoScrollExample/DAAutoScrollExample.xcodeproj/project.pbxproj
@@ -256,7 +256,7 @@
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
SDKROOT = iphoneos;
};
name = Debug;
@@ -274,7 +274,7 @@
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
@@ -287,7 +287,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DAAutoScrollExample/DAAutoScrollExample-Prefix.pch";
INFOPLIST_FILE = "DAAutoScrollExample/DAAutoScrollExample-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -299,7 +299,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DAAutoScrollExample/DAAutoScrollExample-Prefix.pch";
INFOPLIST_FILE = "DAAutoScrollExample/DAAutoScrollExample-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -324,6 +324,7 @@
63DFB69914E9C6B100B050DA /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
View
BIN ...oj/project.xcworkspace/xcuserdata/danielamitay.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
View
13 DAAutoScrollExample/DAAutoScrollExample/TableViewController.m
@@ -46,6 +46,19 @@ - (void)viewDidLoad
[(DAAutoTableView *)self.view startScrolling];
}
+- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
+{
+ if (!decelerate)
+ {
+ [(DAAutoTableView *)self.view startScrolling];
+ }
+}
+
+- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
+{
+ [(DAAutoTableView *)self.view startScrolling];
+}
+
- (void)viewDidUnload
{
[super viewDidUnload];
View
2 DAAutoScrollExample/DAAutoScrollExample/TextViewController.h
@@ -10,7 +10,7 @@
#import "DAAutoTextView.h"
-@interface TextViewController : UIViewController
+@interface TextViewController : UIViewController <UITextViewDelegate>
@property (nonatomic, strong) IBOutlet DAAutoTextView *textView;
View
14 DAAutoScrollExample/DAAutoScrollExample/TextViewController.m
@@ -37,6 +37,7 @@ - (void)viewDidLoad
// Do any additional setup after loading the view from its nib.
self.title = @"Text View";
+ textView.delegate = self;
[textView startScrolling];
}
@@ -53,4 +54,17 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
+- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
+{
+ if (!decelerate)
+ {
+ [textView startScrolling];
+ }
+}
+
+- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
+{
+ [textView startScrolling];
+}
+
@end
View
2 README.md
@@ -32,6 +32,8 @@ For UITextView:
Subclass either via code or Interface Builder.
+To restart scrolling after user interaction, you need to support the UIScrollView delegate methods 'scrollViewDidEndDragging:' and 'scrollViewDidEndDecelerating:', and call `startScrolling` again. The example does this by default.
+
### Automatic Reference Counting (ARC) support
DAAutoScroll was made with ARC enabled by default.

0 comments on commit a8ed6c7

Please sign in to comment.
Something went wrong with that request. Please try again.