我正在绘制UIView
的框架属性(x,y,宽度,高度)值[0, 0, 350, 700]
我希望将其设为框架值为[50, 50, 140, 140]
我希望在不裁剪内容的情况下缩小第一个视图的大小。
这是我的代码:
@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()
}
}
}
答案 0 :(得分:1)
停用clipsToBounds
媒体资源,将UIView
尺寸更改为所需的width
和height
值。
yourView.clipsToBounds = false;
yourView.frame = newFrame;