UIScrollView uses the navigation layout and cannot scroll

case

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.scrollView];
    [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.left.right.mas_equalTo(0);
    }];
}

-(UIScrollView *)scrollView{
    if(! _scrollView) { _scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds]; _scrollView. ContentSize = CGSizeMake (0700); }return _scrollView;
}
Copy the code

Solution 1

Add the following method to the ViewController

-(void)viewDidLayoutSubviews{ [super viewDidLayoutSubviews]; / / set up here Or scroll is not self. The scrollView. ContentSize = CGSizeMake (0700); }Copy the code

Solution 2

UIScrollView+ navigation adaptive width and height