Xamarin 中的 MakeTextWritingDirectionRightToLeft(null) iOS
MakeTextWritingDirectionRightToLeft(null) in xamarin iOS
我正努力在我的项目中实现 RightToLeft
方向。其他工作正常,但标签没有在 iOS 中向右移动为此目的,我创建了一个 LabelRenderer
,我在其中传递了此方法 MakeTextWritingDirectionRightToLeft(null)
,但出现异常
Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[UILabel makeTextWritingDirectionRightToLeft:]: unrecognized selector sent to instance 0x7fd2fb68b680
谁能告诉我在这个函数的参数中传递什么而不是 null?
你可以尝试在我的项目中使用下面的代码来实现从右到左的方向。
[assembly: ExportRenderer(typeof(Label), typeof(CustomLabel))]
public class CustomLabel: LabelRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
{
base.OnElementChanged(e);
Control.TextAlignment = UITextAlignment.Right;
}
}
我正努力在我的项目中实现 RightToLeft
方向。其他工作正常,但标签没有在 iOS 中向右移动为此目的,我创建了一个 LabelRenderer
,我在其中传递了此方法 MakeTextWritingDirectionRightToLeft(null)
,但出现异常
Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[UILabel makeTextWritingDirectionRightToLeft:]: unrecognized selector sent to instance 0x7fd2fb68b680
谁能告诉我在这个函数的参数中传递什么而不是 null?
你可以尝试在我的项目中使用下面的代码来实现从右到左的方向。
[assembly: ExportRenderer(typeof(Label), typeof(CustomLabel))]
public class CustomLabel: LabelRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
{
base.OnElementChanged(e);
Control.TextAlignment = UITextAlignment.Right;
}
}