UIScrollView is often used by developers, so it’s good for us to know some tips about UIScrollView.

  1. In your ViewController, you should add this code below, because it can solve some weird problems.
    1
    self.automaticallyAdjustsScrollViewInsets = NO;
  2. Using these codes can help you say goodbye to weird changes when changing ViewController by pushing the tabbar.
1
2
3
4
5
6
7
8
9
- (void)viewWillAppear:(BOOL)animated {
[superviewWillAppear:animated];
[self.scrollViewsetContentOffset:CGPointMake(self.scrollView.bounds.size.width * self.currentStep, 0) animated:NO];
}

- (void)viewDidLayoutSubviews {
[superviewDidLayoutSubviews];
[self.scrollViewsetContentOffset:CGPointMake(self.scrollView.bounds.size.width * self.currentStep, 0) animated:NO];
}