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?
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.
精彩评论