Skip to content

Commit

Permalink
[UIWebView setScrollsToTop:(BOOL)]
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Sep 29, 2011
1 parent dbb083e commit 497ff1f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions MBCategories.h
Expand Up @@ -10,3 +10,4 @@
#import "UIApplication+mxcl.h" #import "UIApplication+mxcl.h"
#import "UITableView+mxcl.h" #import "UITableView+mxcl.h"
#import "UIView+mxcl.h" #import "UIView+mxcl.h"
#import "UIWebView+mxcl.h"
1 change: 1 addition & 0 deletions MBCategories.m
Expand Up @@ -10,3 +10,4 @@
#import "UIApplication+mxcl.m" #import "UIApplication+mxcl.m"
#import "UITableView+mxcl.m" #import "UITableView+mxcl.m"
#import "UIView+mxcl.m" #import "UIView+mxcl.m"
#import "UIWebView+mxcl.m"
5 changes: 5 additions & 0 deletions UIWebView+mxcl.h
@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>

@interface UIWebView (mxcl)
- (void)setScrollsToTop:(BOOL)scrollsToTop;
@end
11 changes: 11 additions & 0 deletions UIWebView+mxcl.m
@@ -0,0 +1,11 @@
#import "UIWebView+mxcl.h"

@implementation UIWebView (mxcl)
- (void)setScrollsToTop:(BOOL)scrollsToTop {
for (UIScrollView *sv in self.subviews)
if ([sv isKindOfClass:[UIScrollView class]] && [sv respondsToSelector:@selector(setScrollsToTop:)]) {
sv.scrollsToTop = scrollsToTop;
scrollsToTop = NO; // you can only set one scrollsToTop to YES or none will do it
}
}
@end

0 comments on commit 497ff1f

Please sign in to comment.