How to make rounded button in Xamarin.iOS ?

theniceboytheniceboy CNMember

How to make a round look button in Xamarin.iOS?

Best Answer

Answers

  • PostalPostal GEMember
    edited January 2017

    @theniceboy said:
    How to make a round look button in Xamarin.iOS?

    Button.BorderRadius = integer value. If you go with high numbers(30, 40, 50, 70) more rounded you get the button. :smile:

  • PostalPostal GEMember

    @Glayzu said:
    Quickest way would be add:
    myButton.ButtonType = UIButtonType.RoundedRect;

    Or update the Layer

        myButton.Layer.CornerRadius = 2;
        myButton.Layer.BorderWidth = 1;
    

    That approach might be unwieldy if you have lots of buttons, so adding a custom button type class might be the best approach. Something like - https://github.com/migueldeicaza/MonoTouch.Dialog/blob/master/MonoTouch.Dialog/Utilities/GlassButton.cs

    Your choice wouldn't work mate actually it is not correct.

  • GlayzuGlayzu IEMember ✭✭

    My bad, you seem to be right! The following won't work as ButtonType is static.
    myButton.ButtonType = UIButtonType.RoundedRect;

    However this:
    myButton.Layer.CornerRadius = 10;
    definitely does work! The BorderWidth is unnecessary, I'm not sure why I put that there.

    Are we both talking about UIButton's? Because BorderRadius doesn't seem to be a property of UIButton.

Sign In or Register to comment.