StoryBoard中UIScrollView设置contentSize无法滚动

今天开发在Storyboard页面中使用ScrollView,在 viewWillAppear 和 viewDidLoad 中设置了contentSize无效

解决办法:在viewDidAppear设置contentSize

override func viewDidAppear(_ animated: Bool) {
        scrollView.contentSize = CGSize.init(width: UIScreen.main.bounds.width, height: 800);
        scrollView.isScrollEnabled=true;
        scrollView.showsVerticalScrollIndicator = false;
    }

你可能感兴趣的:(StoryBoard中UIScrollView设置contentSize无法滚动)