How to give a Bottom line to a TextField iOS...
To give a underline to textField (Only bottom border) line use the following code:
Here we use CALayer class to achieve it,
-(void)underlineToTextField:(UITextField *)txtField
{
CALayer *border = [CALayer layer];
CGFloat borderWidth = 0.8f;
border.borderColor = [UIcolor greenColor].CGColor;
border.frame = CGRectMake(0, text.frame.size.height - borderWidth, ([[UIScreen mainScreen] bounds].size.width)-32, text.frame.size.height);
border.borderWidth = borderWidth;
[text.layer addSublayer:border];
text.layer.masksToBounds = YES;
}
Call the method for which TextField you want to show underline like below,
[self underlineToTextField:textField];
Thanks for sharing the useful blog about giving Bottomline to the Text field with example.
ReplyDeleteAndroid Application Development Company
all mobile Solutions
ReplyDeleteAbout Mobile Solutions,Smart phone unlocked,Android Tools,Gsm Unlock Tips,All In One Box,Smart Phone Repair,tips and Tutorial.
https://www.alltips24a2z.com/