UIScrollView's origin changes after popping back to the UIViewController

后端 未结 17 2326
不知归路
不知归路 2020-12-07 16:50

I have a UIViewController subclass as a scene in the storyboard that contains a UIScrollView containing various subviews. One of the subviews is a

17条回答
  •  無奈伤痛
    2020-12-07 17:02

    - (void)viewDidDisappear:(BOOL)animated {
        [super viewDidDisappear:animated];
    
        if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7) {
            _isRecoredforios6 = YES;
            _recordedOffsetforios6 = _scrollView.contentOffset;
            _recordedSizeforios6 = _scrollView.contentSize;
            _scrollView.contentOffset = CGPointZero;
        }
    
    }
    
    - (void)viewDidLayoutSubviews {
        [super viewDidLayoutSubviews];
    
        if (_isRecoredforios6) {
            _isRecoredforios6 = NO;
            _scrollView.contentSize = _recordedSizeforios6;
            _scrollView.contentOffset = _recordedOffsetforios6;
        }
    }
    

    I have fixed this ios6 bug , can be solved using these codes. I solved bug occurred in Scrollview. Thank above all my friends!

提交回复
热议问题