Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to give bottom border to your textField

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 326
    Comment on it

    By using below code you can give bottom border to your text fields

    -(void)giveBottomBorderToTheTextField:(UITextField *)textField{
        
        CALayer *border = [CALayer layer];
        CGFloat borderWidth = 2;
        border.borderColor = [UIColor darkGrayColor].CGColor;
        border.frame = CGRectMake(0, textField.frame.size.height - borderWidth, textField.frame.size.width, textField.frame.size.height);
        border.borderWidth = borderWidth;
        [textField.layer addSublayer:border];
        textField.layer.masksToBounds = YES;   
    
    }

    In the above code First we have to made border and given width i.e 2 . Then given border color to the text field by using Border.BorderColor , we have given dark grey to the border. here mask to bound shows bottom border color to the complete text field.

     

    and now use this method in following way, here _userNameTextFieldlbl is your text field

    [self giveBottomBorderToTheTextField:_userNameTextFieldlbl];

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: