Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIButton with Custom border colour, iPhone

I want to create Custom UIButton with rectangular shape. for this I am using rectangular view as a Background for UIButton and making UIbuttons background colour as clearcolor. But border of UIbutton still remains. any suggestions on how to make border disappear? Thanks for any help in advance..

like image 981
alekhine Avatar asked Sep 09 '11 05:09

alekhine


People also ask

How do I add a border to UIButton storyboard?

Border Color you can set your UIButton User Defined Run Time Attributes ie borderWidth, cornerRadius, borderColor etc. As shown in the image. Note:- don't use layer. before the attribute name, it will not work.

How to set border Color in Swift?

You need to set the borderWidth from the UITextField 's layer property. Like: email. layer. borderWidth = 1 .

How do you change the border color on a storyboard?

borderColor property. This can be accomplished by creating a Category on CALayer, setting the Key Path to a unique new "property" ( borderColorFromUIColor ), and in the category overriding the corresponding setter ( setBorderColorFromUIColor: ).


1 Answers

Try this:

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button.layer setBorderColor:[[UIColor clearColor] CGColor]];

but don't forget to add in your .h or .m file

#import <QuartzCore/QuartzCore.h>
like image 76
Prabh Avatar answered Sep 28 '22 06:09

Prabh