0

I'm customizing a UITextField to be taller and have different border colors and shadows than the default:

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
    textField.layer.shadowOpacity = 0.f;
    textField.layer.cornerRadius = 6.f;
    textField.layer.borderColor = [[UIColor colorWithRed:196/255.0 green:111/255.0 blue:3/255.0 alpha:1] CGColor];
    textField.layer.borderWidth = 1.f;

    return YES;
}

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    textField.layer.shadowColor = [[UIColor blackColor] CGColor];
    textField.layer.shadowOpacity = .2f;
    textField.layer.shadowOffset = CGSizeMake(0,3);
    textField.layer.shadowRadius = 3.f;
    textField.clipsToBounds = NO;

    textField.layer.cornerRadius = 6.0f;
    textField.layer.borderColor = [[UIColor colorWithRed:196/255.0 green:111/255.0 blue:3/255.0 alpha:1] CGColor];
    textField.layer.borderWidth = 3.f;

    return YES;
}

However, it seems that something is screwing up the rendering of the border in the 'unfocused' state in the bottom left hand:

stroke issue in uitextfield

4

0 回答 0