This commit is contained in:
Nick Mathews 2016-12-10 16:22:24 -05:00
Родитель 659c6b271a
Коммит dead93ad2b
2 изменённых файлов: 29 добавлений и 29 удалений

Просмотреть файл

@ -8,29 +8,29 @@ using Xamarin.Forms.Platform.iOS;
[assembly: ExportEffect(typeof(ItalicPlaceholderEffect), nameof(ItalicPlaceholderEffect))]
namespace FormsCommunityToolkit.Effects.iOS.Effects
{
[Preserve(AllMembers = true)]
public class ItalicPlaceholderEffect : PlatformEffect
{
private NSAttributedString _old;
[Preserve(AllMembers = true)]
public class ItalicPlaceholderEffect : PlatformEffect
{
private NSAttributedString _old;
protected override void OnAttached()
{
var entry = Control as UITextField;
if (entry != null && !string.IsNullOrWhiteSpace(entry.Placeholder))
{
_old = entry.AttributedPlaceholder;
var entryFontSize = entry.Font.PointSize;
entry.AttributedPlaceholder = new NSAttributedString(entry.Placeholder, font: UIFont.ItalicSystemFontOfSize(entryFontSize));
}
}
protected override void OnAttached()
{
var entry = Control as UITextField;
if (entry != null && !string.IsNullOrWhiteSpace(entry.Placeholder))
{
_old = entry.AttributedPlaceholder;
var entryFontSize = entry.Font.PointSize;
entry.AttributedPlaceholder = new NSAttributedString(entry.Placeholder, font: UIFont.ItalicSystemFontOfSize(entryFontSize));
}
}
protected override void OnDetached()
{
var entry = Control as UITextField;
if (entry != null)
{
entry.AttributedPlaceholder = _old;
}
}
}
protected override void OnDetached()
{
var entry = Control as UITextField;
if (entry != null)
{
entry.AttributedPlaceholder = _old;
}
}
}
}

Просмотреть файл

@ -3,10 +3,10 @@ using Xamarin.Forms;
namespace FormsCommunityToolkit.Effects
{
public class ItalicPlaceholderEffect : RoutingEffect
{
public ItalicPlaceholderEffect() : base("Organon.Effects.ItalicPlaceholderEffect")
{
}
}
public class ItalicPlaceholderEffect : RoutingEffect
{
public ItalicPlaceholderEffect() : base("Organon.Effects.ItalicPlaceholderEffect")
{
}
}
}