gpt4 book ai didi

ios - 在不剪切内容的情况下减小 UIView 的大小

转载 作者:可可西里 更新时间:2023-11-01 02:08:51 27 4
gpt4 key购买 nike

我在 UIView 中绘制,框架属性(x、y、宽度、高度)值 [0, 0, 350, 700]

我想让它成为具有帧值的 View 的 subview [50, 50, 140, 140]

我想在不裁剪内容的情况下缩小第一个 View 的大小。

这是我的代码:

@IBAction func btnSignPressed(_ sender: Any) {

for i in 1...drawTag {
if (i == drawTag) {
AddSignView = ACEDrawingView()
AddSignView.tag = 1
AddSignView.frame = ViewSignature.frame //where ViewSignature Frame is equal to view.frame
ViewSignature.addSubview(AddSignView)
DrawingViewCollection.append(AddSignView)
}
}
}

@IBAction func btnSavepressed(_ sender: Any) {

for i in 1...viewTag {
if (i == viewTag) {
let person = ZDStickerView()
let gripFrame1 = CGRect(x: CGFloat(0), y: CGFloat(0), width: CGFloat(140), height: CGFloat(140))
let contentView = UIView(frame: gripFrame1)

contentView.clipsToBounds = true
contentView.addSubview(DrawingViewCollection[i - 1])
contentView.clipsToBounds = true

person.frame = gripFrame1
person.stickerViewDelegate = self
person.contentView = contentView
//contentView;
person.preventsPositionOutsideSuperview = true
person.translucencySticker = true
person.showEditingHandles()

ZdStickerCollection.append(person)
pdfCollectionView.reloadData()
}
}
}

最佳答案

禁用 clipsToBounds属性(property)并改变你的UIView您想要的尺寸 widthheight值(value)。

yourView.clipsToBounds = false;
yourView.frame = newFrame;

关于ios - 在不剪切内容的情况下减小 UIView 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41629539/

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