在应用程序内更改语言时,我需要根据所选语言更改应用程序布局。在iOS应用程序中将LTR转换为RTL [未关闭应用程序]
例如,基本语言是英语;当用户将其更改为阿拉伯语时,我需要根据RTL更改UI。
故事板或ViewController中是否有任何特定的设置来实现LTR和RTL?
在应用程序内更改语言时,我需要根据所选语言更改应用程序布局。在iOS应用程序中将LTR转换为RTL [未关闭应用程序]
例如,基本语言是英语;当用户将其更改为阿拉伯语时,我需要根据RTL更改UI。
故事板或ViewController中是否有任何特定的设置来实现LTR和RTL?
管理RTL和LTR而不关闭应用程序Swift 3.0。
// RTL
UIView.appearance()。semanticContentAttribute = .forceRightToLeft UINavigationBar.appearance()。semanticContentAttribute = .forceRightToLeft
// applicationNavigationController是应用默认导航控制器 如果让applicationNavigationController = storyboard?.instantiateViewController(withIdentifier:“root”){UIApplication.shared.keyWindow?.rootViewController = applicationNavigationContr奥勒
LTR //
UIView.appearance()semanticContentAttribute = .forceLeftToRight UINavigationBar.appearance()semanticContentAttribute = .forceLeftToRight 如果让applicationNavigationController =故事板.instantiateViewController(withIdentifier:? “根” ){ UIApplication.shared.keyWindow?.rootViewController = applicationNavigationController
//与MMDrawer交易时的其他提示。
的AppDelegate
VAR centerContainer:MMDrawerController?
在一个ViewController中实现MMDrawer代码。
let appdelegate = UIApplication.shared.delegate as! 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)