2017-03-27 23 views
1

アプリケーション内で言語を変更する場合、選択した言語ごとにアプリケーションのレイアウトを変更する必要があります。iOSアプリケーションのLTR to RTL

たとえば、基本言語は英語です。ユーザーがアラビア語に変更すると、RTLごとにUIを変更する必要があります。

LTRとRTLを達成するために、ストーリーボードまたはViewControllerに特定の設定がありますか?

答えて

0

アプリケーションSwift 3.0を終了せずにRTLとLTRを管理する。

// RTL

UIView.appearance()。semanticContentAttribute = .forceRightToLeft UINavigationBar.appearance()。semanticContentAttribute = .forceRightToLeft

// applicationNavigationControllerは、アプリケーションのデフォルトナビゲーションコントローラ 場合でありますapplicationNavigationController = storyboard?.instantiateViewController(withIdentifier: "root"){ UIApplication.shared.keyWindow?rootviewController = applicationNavigationContr 。。?oller

LTR //

UIView.appearance()semanticContentAttribute = .forceLeftToRight UINavigationBar.appearance()semanticContentAttribute = .forceLeftToRight 許可すればapplicationNavigationControllerは=ストーリーボード.instantiateViewController(withIdentifier: "ルート" ){ UIApplication.shared.keyWindow?rootViewController = applicationNavigationController

// MMDrawerを扱う際のヒント。

AppDelegate

のvar centerContainer:MMDrawerController?

1つのViewController内にMMDrawerコードを実装します。

let appdelegate = UIApplication.shared.delegate! AppDelegate

let mainStoryboard:UIStoryboard=UIStoryboard(name: "Main", bundle: nil) 

    let centerViewController = mainStoryboard.instantiateViewController(withIdentifier: "HomeViewController") as! HomeViewController 
    let leftViewController = mainStoryboard.instantiateViewController(withIdentifier: "LeftSideMenuViewController") as! LeftSideMenuViewController 



    let leftSideNav = UINavigationController(rootViewController: leftViewController) 
    let centerNav = UINavigationController(rootViewController: centerViewController) 


    appdelegate.centerContainer = MMDrawerController(center: centerNav, leftDrawerViewController: leftSideNav) 

    appdelegate.centerContainer?.maximumLeftDrawerWidth = 250.0 


    appdelegate.centerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.panningCenterView 
    appdelegate.centerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.all 

    ////////// 
    self.navigationController?.pushViewController(appdelegate.centerContainer!, animated: false) 
関連する問題