簡體   English   中英

UIButton-高亮狀態下的圓角

[英]UIButton - rounded corners in highlight state

在下面的圖像中,按鈕被按下。 陰影是方形的。 如何使陰影具有圓角邊緣? 在此處輸入圖片說明

這是我的操作方式:

1)子類化UIButton

2)像這樣更改圖層:

public class GalleryButton: UIButton
    {

        public GalleryButton (RectangleF frame) : base(frame)
        {
            this.Layer.CornerRadius = 12f;
            this.Layer.MasksToBounds = true;
            this.Layer.BorderWidth = 0f;
        }

我認為,如果您有透明的png,它會按原樣工作。

暫無
暫無

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

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