I’m trying to create a NativeScript <TextField>
that only has a single border underneath the control. There are several Stack Overflow questions that address this problem for UITextField
s generically (such as How to only show bottom border of UITextField in Swift), however—for whatever reason—those same techniques don’t appear to work for NativeScript <TextField>
s.
For instance I would expect this code to work:
<!-- my-page.xml -->
<TextField id="email" />
/* my-page.js */
var myTextField = page.getViewById("email").ios;
var bottomLine = new CALayer();
bottomLine.frame = CGRectMake(1, 50, 50, 1);
bottomLine.backgroundColor = UIColor.whiteColor().CGColor;
myTextField.borderStyle = UITextBorderStyle.None;
myTextField.layer.addSublayer(bottomLine);
...but no border is drawn.
I’m not sure if I’m doing something wrong, or if something like {N}’s CSS implementation is overwriting my changes. Any help would be appreciated.
Thanks!