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..
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.
You need to set the borderWidth from the UITextField 's layer property. Like: email. layer. borderWidth = 1 .
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: ).
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With