i have a weird issue with a UIScrollView
and a UIWebView
in it.
First my setup:
I subclassed a UIView and added the following code to it:
.h
@interface MySubclassedView : UIView {
UIScrollView *scrollView;
UIWebView *contentView;
}
@property(nonatomic,retain) UIWebView *contentView;
.m
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self setupContentView];
}
return self;
}
setupContentView
-(void)setupContentView {
// Content View
self.contentView = [[UIWebView alloc] init];
self.contentView.backgroundColor = [UIColor whiteColor];
// ScrollView
scrollView = [[UIScrollView alloc] init];
scrollView.backgroundColor = [UIColor whiteColor];
scrollView.alwaysBounceVertical = YES;
[scrollView addSubview:self.contentView];
[self addSubview:scrollView];
}
and my layoutSubViews
- (void)layoutSubviews {
XLog(""); // something like NSLog
[super layoutSubviews];
scrollView.frame = CGRectMake(0,0, self.width, self.height);
self.contentView.frame = CGRectMake(0,0, self.width, self.height);
}
The Problem with all of this is, that it bounces the first time when my scrollview is not completely scrolled to the top. after the scrollview is scrolled to top or bottom i cannot drag the view downwards but the layoutSubviews
method gets called on and on as long as i'm dragging.
For better understanding i made a short screen video to demonstrate the behavior: http://www.screenr.com/Gy9
thanks for all help. if something is unclear, please let me know in the comments.