Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Simplify the code used to set the same font size for Editor/Entry. #13150

Merged
merged 4 commits into from
Feb 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions src/Core/src/Platform/iOS/MauiTextView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.Maui.Platform
public class MauiTextView : UITextView
{
readonly UILabel _placeholderLabel;
nfloat _defaultPlaceholderSize = -1;
nfloat? _defaultPlaceholderSize;

public MauiTextView()
{
Expand Down Expand Up @@ -176,18 +176,9 @@ void ShouldCenterVertically()

void UpdatePlaceholderFontSize(UIFont? value)
{
if (value != null)
{
if (_defaultPlaceholderSize == -1)
{
_defaultPlaceholderSize = _placeholderLabel.Font.PointSize;
}
_placeholderLabel.Font = _placeholderLabel.Font.WithSize(value.PointSize);
}
else if (_defaultPlaceholderSize != -1)
{
_placeholderLabel.Font = _placeholderLabel.Font.WithSize(_defaultPlaceholderSize);
}
_defaultPlaceholderSize ??= _placeholderLabel.Font.PointSize;
_placeholderLabel.Font = _placeholderLabel.Font.WithSize (
value?.PointSize ?? _defaultPlaceholderSize.Value);
}
}
}
}