[英]Why does a selected image overflow the button border in swift?
I am trying to create a profile image selection button.我正在尝试创建个人资料图像选择按钮。 However, every time I select an image with UIImagePickerController, the image overflows the bottom of the button border.
但是,每次我用 UIImagePickerController select 一个图像时,图像都会溢出按钮边框的底部。 Is there a way to make sure the image stays within the border
有没有办法确保图像保持在边界内
Set buttons clip to bounds true将按钮剪辑设置为边界 true
button.clipsToBounds = true
Select clipToBounds from attributes section, or add button.clipsToBounds = true
. Select clipToBounds 从属性部分,或添加
button.clipsToBounds = true
。 Try using Autofit
as well.也尝试使用
Autofit
。 it is also available in attribute
section on storyboard.它也可以在 storyboard 的
attribute
部分中找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.