ネストされたスクロールビューのペアを実装しようとしているときに、小さな問題に遭遇しました。私はそれらを実装することができましたが、私が持っている画像は正しく表示されていないようです。それらは個別には問題ありませんでしたが、スクロール ビューをネストすると、フレームのサイズと位置が変化するように見えます。
そして、これが私のコードの一部であり、私が間違っていることを示す可能性があります。
- (void)loadView
{ {
CGRect baseScrollViewFrame = [self frameForBaseScrollView];
baseScrollView = [[UIScrollView alloc] initWithFrame:baseScrollViewFrame];
[baseScrollView setBackgroundColor:[UIColor blackColor]];
[baseScrollView setCanCancelContentTouches:NO];
baseScrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
baseScrollView.showsVerticalScrollIndicator = NO;
baseScrollView.showsHorizontalScrollIndicator = YES;
baseScrollView.scrollEnabled = YES;
baseScrollView.pagingEnabled = YES;
//baseScrollView.delaysContentTouches = NO;
baseScrollView.userInteractionEnabled = YES;
baseScrollView.contentSize = CGSizeMake(baseScrollViewFrame.size.width * [self imageCount], baseScrollViewFrame.size.height);
baseScrollView.delegate = self;
self.view = baseScrollView;
[baseScrollView release];
これは、ベースの HORIZONTAL スクロール ビュー用です。
CGRect pagingScrollViewFrame = [self frameForPagingScrollView];
pagingScrollView = [[UIScrollView alloc] initWithFrame:pagingScrollViewFrame];
pagingScrollView.pagingEnabled = YES;
pagingScrollView.backgroundColor = [UIColor blackColor];
[pagingScrollView setCanCancelContentTouches:NO];
pagingScrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
pagingScrollView.showsVerticalScrollIndicator = YES;
pagingScrollView.showsHorizontalScrollIndicator = NO;
pagingScrollView.scrollEnabled = YES;
pagingScrollView.contentSize = CGSizeMake(pagingScrollViewFrame.size.width, pagingScrollViewFrame.size.height * [self imageCount]);
pagingScrollView.delegate = self;
[baseScrollView addSubview:pagingScrollView];
これは、ページング VERTICAL スクロール ビュー用です。
誰か、私が間違っていることを教えてください。
どうもありがとう