UIScrollView not scrolling in Swift

前端 未结 12 1177
Happy的楠姐
Happy的楠姐 2021-02-03 19:03

My UIScrollView won\'t scroll down. I don\'t know why. I already followed Apple documentation regarding to this issue.

@IBOutlet weak var scroller: UIScrollView!         


        
12条回答
  •  半阙折子戏
    2021-02-03 19:27

    FWIW, I found that I needed to use sathish's solution from above, though it was insufficient to effect the intervention in viewDidAppear alone. I had to instead make the adjustment for every new content assignment:

    func display(pattern: Pattern) {
        let text : NSAttributedString = pattern.body()
        patternTextView.attributedText = text
    
        // Set the size of the view. Autolayout seems to get in the way of
        // a correct size calculation
        patternTextView.contentSize = CGSize(width: 348, height: 620)
    }
    

    The manifest constants (yeah, I know, yuk, but it makes it easier to understand here) are from the autolayout spec.

提交回复
热议问题