iOS下,如果我們的self.view 的第一個子試圖直接就是scrollView的話,那麼ScrollVIew的所有子試圖都會下移64個像素。
self.automaticallyAdjustsScrollViewInsets = NO;
self.headerScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, 30)];
_headerScrollView.contentSize = CGSizeMake(offX, 0);
self.headerScrollView.bounces = NO;
self.headerScrollView.showsHorizontalScrollIndicator = NO;
self.headerScrollView.showsVerticalScrollIndicator = NO;
[self.headerScrollView addSubview:_headerView];
[self.view addSubview:self.headerScrollView];