У меня есть UITextView
и мне нужно увеличить расстояние между символами.Я уже применил UIStringAttributeKey.KerningAdjustment
, и это сработало, но теперь попытка уменьшить UIFont
с UITextView
перестает работать.
ViewController:
textView.ChangeSpaceBetweenCharacters(8.0f);
TextViewExtension:
public static void ChangeSpaceBetweenCharacters(this UITextField textField, float space)
{
textField.WeakDefaultTextAttributes.SetValueForKey(NSObject.FromObject((nfloat)space), UIStringAttributeKey.KerningAdjustment);
}

и попытался ...
ViewController:
textView.ChangeSpaceBetweenCharacters(8.0f, UIFont("ArialMT", 13);
TextViewExtension:
public static void ChangeSpaceBetweenCharacters(this UITextField textField, float space, UIFont font)
{
textField.AttributedText = new NSAttributedString(textField.Text, new UIStringAttributes
{
Font = font,
KerningAdjustment = space
});
}

Я уже пытался изменить UIFont
до и после UIStringAttributeKey.KerningAdjustment
, но он все еще не работал.
Я провел много исследований и до сих пор не могу понять, что происходит.
Кто-нибудь может мне помочь?
С наилучшими пожеланиями, Рафаэль Сантос