зеркало из https://github.com/DeGsoft/maui-linux.git
[iOS] Check new element before creating placeholder label (#5432)
* Check new element before creating placeholder label * additional checks * create placeholder once
This commit is contained in:
Родитель
21c7567e02
Коммит
a372395fb2
|
@ -31,15 +31,23 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
|
||||
{
|
||||
// create label so it can get updated during the initial setup loop
|
||||
_placeholderLabel = new UILabel
|
||||
bool initializing = false;
|
||||
if (e.NewElement != null && _placeholderLabel == null)
|
||||
{
|
||||
BackgroundColor = UIColor.Clear
|
||||
};
|
||||
initializing = true;
|
||||
// create label so it can get updated during the initial setup loop
|
||||
_placeholderLabel = new UILabel
|
||||
{
|
||||
BackgroundColor = UIColor.Clear
|
||||
};
|
||||
}
|
||||
|
||||
base.OnElementChanged(e);
|
||||
|
||||
CreatePlaceholderLabel();
|
||||
if (e.NewElement != null && initializing)
|
||||
{
|
||||
CreatePlaceholderLabel();
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void UpdateFont()
|
||||
|
@ -63,6 +71,9 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
void CreatePlaceholderLabel()
|
||||
{
|
||||
if (Control == null)
|
||||
return;
|
||||
|
||||
Control.AddSubview(_placeholderLabel);
|
||||
|
||||
var edgeInsets = TextView.TextContainerInset;
|
||||
|
|
Загрузка…
Ссылка в новой задаче