UIScrollView
その中の aと aに奇妙な問題がありUIWebView
ます。最初に私のセットアップ:
UIView をサブクラス化し、次のコードを追加しました。
.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];
}
そして私の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);
}
このすべての問題は、スクロールビューが完全に一番上までスクロールされていないときに初めてバウンスすることです。スクロールビューが上または下にスクロールされた後、ビューを下にドラッグすることはできませんが、ドラッグしlayoutSubviews
ている限りメソッドが何度も呼び出されます。
理解を深めるために、動作を示す短い画面ビデオを作成しました: http://www.screenr.com/Gy9
すべての助けに感謝します。不明な点がある場合は、コメントでお知らせください。