簡體   English   中英

為什么在 swift 中選擇的圖像會溢出按鈕邊框?

[英]Why does a selected image overflow the button border in swift?

在此處輸入圖像描述

我正在嘗試創建個人資料圖像選擇按鈕。 但是,每次我用 UIImagePickerController select 一個圖像時,圖像都會溢出按鈕邊框的底部。 有沒有辦法確保圖像保持在邊界內

將按鈕剪輯設置為邊界 true

button.clipsToBounds = true

Select clipToBounds 從屬性部分,或添加button.clipsToBounds = true 也嘗試使用Autofit 它也可以在 storyboard 的attribute部分中找到。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM