您好我正在尝试使scrollview范围适合内容。
到目前为止我有什么
@IBOutlet var articleScroll: UIScrollView!
articleTitle.text = defaultValue1
firstSection.text = defaultValue2
let fixedWidth = firstSection.frame.size.width
firstSection.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.max))
let newSize = firstSection.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.max))
var newFrame = firstSection.frame
newFrame.size = CGSize(width: max(newSize.width, fixedWidth), height: newSize.height)
firstSection.frame = newFrame;
我尝试了这个,但它没有用
articleScroll.contentsize.height = newFrame.height
适用于UITextView,因为它调整了textview的大小以适应内容。现在我希望scrollview能够适应内容。我该如何添加?