圓形我如何設置的UIButton的形象,這形象是有邊界圓形我寫相關的代碼,但圖像中適當的圓形不顯示.. 這裏是我的代碼..如何設置UIButton的形象,這形象是與邊界
btnMyProfile.setImage(UIImage(named: "MyDefaultImg.png"), for: .normal)
btnMyProfile.imageView?.contentMode = .scaleAspectFit
btnMyProfile.imageView?.layer.cornerRadius = (btnMyProfile.imageView?.frame.width)!/2
btnMyProfile.imageView?.layer.borderColor = UIColor.blue.cgColor
btnMyProfile.imageView?.layer.borderWidth = 2.0
我能爲實現我做我期望的輸出?請幫我..謝謝..先進
我改變了但沒有效果。 – NiravS
@NiravS - 檢查更新後的答案 –
我將按鈕大小更改爲Square,因此可以看到完美的圓形,但我需要在按鈕中設置小圖像。那我該怎麼辦? – NiravS