mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-27 17:08:00 +01:00
bottom border on picker and no padding on editor
This commit is contained in:
parent
d44950d46c
commit
39284b475d
@ -9,6 +9,11 @@
|
||||
<Setter Property="Margin"
|
||||
Value="0, 5, 0, 12" />
|
||||
</Style>
|
||||
<Style TargetType="Picker"
|
||||
ApplyToDerivedTypes="True">
|
||||
<Setter Property="Margin"
|
||||
Value="0, 5, 0, 12" />
|
||||
</Style>
|
||||
<Style TargetType="Editor"
|
||||
ApplyToDerivedTypes="True">
|
||||
<Setter Property="PlaceholderColor"
|
||||
|
@ -15,6 +15,9 @@ namespace Bit.iOS.Renderers
|
||||
{
|
||||
var descriptor = UIFontDescriptor.PreferredBody;
|
||||
Control.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
|
||||
// Remove padding
|
||||
Control.TextContainerInset = new UIEdgeInsets(0, 0, 0, 0);
|
||||
Control.TextContainer.LineFragmentPadding = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace Bit.iOS.Renderers
|
||||
{
|
||||
Control.ClearButtonMode = UITextFieldViewMode.WhileEditing;
|
||||
UpdateFontSize();
|
||||
SetBottomBorder();
|
||||
iOSHelpers.SetBottomBorder(Control);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,26 +47,5 @@ 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),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Bit.iOS.Renderers;
|
||||
using Bit.iOS.Utilities;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
@ -15,6 +16,7 @@ namespace Bit.iOS.Renderers
|
||||
{
|
||||
var descriptor = UIFontDescriptor.PreferredBody;
|
||||
Control.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
|
||||
iOSHelpers.SetBottomBorder(Control);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Utilities
|
||||
{
|
||||
@ -27,5 +28,36 @@ namespace Bit.iOS.Utilities
|
||||
}
|
||||
return pointSize;
|
||||
}
|
||||
|
||||
public static void SetBottomBorder(UITextField control)
|
||||
{
|
||||
control.BorderStyle = UITextBorderStyle.None;
|
||||
SetBottomBorder(control as UIView);
|
||||
}
|
||||
|
||||
public static void SetBottomBorder(UITextView control)
|
||||
{
|
||||
SetBottomBorder(control as UIView);
|
||||
}
|
||||
|
||||
private static void SetBottomBorder(UIView control)
|
||||
{
|
||||
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),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user