Unable to set border for flat ui kit in xcode?

214 Views Asked by At

I'm using the flatui kit found here https://github.com/Grouper/FlatUIKit as an add-on for ios development in xcode. When I make a text field, it fails to properly set the border as a uicolor. I'm using what's showed in the tutorial on the github page, but it doesn't seem to work. My code for setting the properties is as follows:

_NameField.font = [UIFont flatFontOfSize:16];
    _NameField.backgroundColor = [UIColor clearColor];
    _NameField.edgeInsets = UIEdgeInsetsMake(4.0f, 15.0f, 4.0f, 15.0f);
    _NameField.textFieldColor = [UIColor whiteColor];
    _NameField.borderColor = [UIColor turquoiseColor];
    _NameField.borderWidth = 20;
    _NameField.cornerRadius = 3.0f;

I have set the text field as an outlet named _NameField, changed the outlet type to an FUITextField, and set the class on the storyboard as an FUITextField. Thanks for the help!

Also, I searched the example included with the github download and it does not implement the FUITextField element.

1

There are 1 best solutions below

0
On

I looked into the FUITextField.m file of the package and studied up on how it works. I found an error where it declares:

- (void)configureTextField {
    _flatBackgroundImage = [self textFieldImageWithColor:_textFieldColor borderColor:_borderColor borderWidth:0 cornerRadius:_cornerRadius];
    _flatHighlightedBackgroundImage = [self textFieldImageWithColor:_textFieldColor borderColor:_borderColor borderWidth:_borderWidth cornerRadius:_cornerRadius];

    [self setBackground:_flatBackgroundImage];
}

I noticed how the borderWidth is set to 0. Instead I changed this to _borderWidth, and it worked! :)