bottom border for ios entry

This commit is contained in:
Kyle Spearrin 2019-06-21 16:09:20 -04:00
parent e9b55bc207
commit d44950d46c
2 changed files with 25 additions and 0 deletions

View file

@ -6,6 +6,8 @@
ApplyToDerivedTypes="True">
<Setter Property="PlaceholderColor"
Value="{StaticResource InputPlaceholderColor}" />
<Setter Property="Margin"
Value="0, 5, 0, 12" />
</Style>
<Style TargetType="Editor"
ApplyToDerivedTypes="True">

View file

@ -15,7 +15,9 @@ namespace Bit.iOS.Renderers
base.OnElementChanged(e);
if(Control != null && e.NewElement is Entry)
{
Control.ClearButtonMode = UITextFieldViewMode.WhileEditing;
UpdateFontSize();
SetBottomBorder();
}
}
@ -45,5 +47,26 @@ namespace Bit.iOS.Renderers
}
}
}
private void SetBottomBorder()
{
Control.BorderStyle = UITextBorderStyle.None;
var borderLine = new UIView
{
BackgroundColor = ((Color)Xamarin.Forms.Application.Current.Resources["BoxBorderColor"]).ToUIColor(),
TranslatesAutoresizingMaskIntoConstraints = false
};
Control.AddSubview(borderLine);
Control.AddConstraints(new NSLayoutConstraint[]
{
NSLayoutConstraint.Create(borderLine, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 1f),
NSLayoutConstraint.Create(borderLine, NSLayoutAttribute.Leading, NSLayoutRelation.Equal,
Control, NSLayoutAttribute.Leading, 1, 0),
NSLayoutConstraint.Create(borderLine, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal,
Control, NSLayoutAttribute.Trailing, 1, 0),
NSLayoutConstraint.Create(borderLine, NSLayoutAttribute.Top, NSLayoutRelation.Equal,
Control, NSLayoutAttribute.Bottom, 1, 10f),
});
}
}
}