gpt4 book ai didi

ios - 在scrollView ios swift中放大UIView

转载 作者:行者123 更新时间:2023-11-30 11:56:14 27 4
gpt4 key购买 nike

我有一个更大的 UIview(例如:200x200),需要适合 ScrollView(100x100),我想缩小 Uiview 以适应 ScrollView 的大小并在初始加载期间显示它。

最佳答案

    var aspectCalX = self.view.frame.width(this is smaller View) / a4view.frame.width(this is bigger View)
var aspectCalY = self.view.frame.height(this is smaller view) / a4view.frame.height(this is bigger view)

biggerview.autoresizesSubviews = true

biggerview.transform = CGAffineTransform(scaleX: aspectCalX, y: aspectCalY)
biggerview.frame = CGRect(x: 0.0, y: 0.0, width: a4view.frame.width, height: a4view.frame.height)
smallerView.addSubview(biggerview)

关于ios - 在scrollView ios swift中放大UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47786824/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com