开发者

UIButton - rounded corners in highlight state

In the image below the button is being pressed. The shadow is square. How do I make the shadow have rou开发者_运维知识库nded edges?

UIButton - rounded corners in highlight state


Here's how I did it:

1) Subclass the UIButton

2) Change the Layer like this:

public class GalleryButton: UIButton
    {

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


I think if you have a transparent png, it works as it is.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜