UIScrollview Autolayout Issue

前端 未结 9 673
广开言路
广开言路 2020-12-05 07:19

I have a problem with autolayout(maybe) and my scrollview!

My Problem

  1. I scroll down \"View\"
9条回答
  •  时光取名叫无心
    2020-12-05 07:44

    try this

    @property (nonatomic, assign) CGPoint scrollViewContentOffsetChange;
    
    - (void)viewWillAppear:(BOOL)animated
    {
        [super viewWillAppear:animated];
        self.scrollView.contentOffset = CGPointZero;
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
        [super viewWillDisappear:animated];
        self.scrollViewContentOffsetChange = _scrollView.contentOffset;
    }
    
    - (void)viewDidLayoutSubviews {
        [super viewDidLayoutSubviews];
        _scrollView.contentOffset = self.scrollViewContentOffsetChange;
    }
    

提交回复
热议问题