Right-To-Left for Xamarin.iOS using Resx Localization

Guys...
i've implemented Resx Localization in my Cross-Platform App..
now in iOS i want to have my view from Right To Left since the second language is Arabic
i read about the Xamarin.Forms Right-To-Left but since am not using FORMS i'am unable to use that technique

i've tried the below code:(on Button Click, inside ViewDidLoad)
UIView.GetUserInterfaceLayoutDirection(UISemanticContentAttribute.ForceRightToLeft);

but the view didnt flip...

My apologies if the answers to to question would be easy but i will be needing some guidances.
Thanks and will appreciate the answers.

Tagged:

Answers

  • LucasZhangLucasZhang Member, Xamarin Team Xamurai
    edited December 2018

    Refer the following code

       using System.Runtime.InteropServices;
       using UIKit;
       namespace Your.Namespace
        {
           public class YourClass 
           {
               [DllImport (ObjCRuntime.Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")]
                internal extern static IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector, UISemanticContentAttribute arg1);
    
                void ButtonClickAction()
                 {
                    Selector selector = new Selector ("setSemanticContentAttribute:");
                    IntPtr_objc_msgSend (UIView.Appearance.Handle, selector.Handle, UISemanticContentAttribute.ForceRightToLeft);
                  }
              }
         }
    
Sign In or Register to comment.