UIScrollView scroll not working after pushed with a navigation controller

前端 未结 2 1897
心在旅途
心在旅途 2021-01-22 09:12

I\'m having an odd problem. I have a UIScrollView in a part of view hierarchy. It\'s working just fine when the view is presented via UITabBarController, but doesn\'t work at al

相关标签:
2条回答
  • 2021-01-22 09:20

    I've solved this problem, but forgot to post it...

        - (void) viewDidLayoutSubviews 
        {
            [self resizeScrollViewContent];
        }
    
        - (void) resizeScrollViewContent
        {
            self.scrollView.contentSize = CGSizeMake(320.0f, 468.0f);
        }
    

    Or you could use this as well:

        - (void) viewDidLayoutSubviews 
        {
            self.scrollView.contentSize = CGSizeMake(320.0f, 468.0f);
        }
    
    0 讨论(0)
  • 2021-01-22 09:28

    If you resize the scroll view content size in the viewDidLayoutSubview function it will work again.

    - (void) viewDidLayoutSubviews {
        [self resizeScrollViewContent];
    }
    

    and
    here same question

    0 讨论(0)
提交回复
热议问题