Hi all,
To underline your button use this class :-
.h
@interface UnderLineButton : UIButton
@end
.m
@implementation UnderLineButton
- (void)drawRect:(CGRect)rect {
// Drawing code
CALayer *bottomBorder = [CALayer layer];
bottomBorder.frame = CGRectMake(0.0f, self.frame.size.height-0.2, self.frame.size.width, 0.5f);
bottomBorder.backgroundColor = [UIColor blackColor].CGColor;
[self.layer addSublayer:bottomBorder];
}
@end
To give border to UIButton use this class :-
.h
@interface BorderRoundButton : UIButton
@end
.m
@implementation BorderRoundButton
- (id)init
{
self = [super init];
if (self) {
}
return self;
}
- (void)awakeFromNib
{
[super awakeFromNib];
[self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[self setBackgroundColor:[UIColor whiteColor]];
[self.layer setBorderColor:[UIColor blackColor].CGColor];
[self.layer setBorderWidth:1.0];
}
@end
0 Comment(s)