gpt4 book ai didi

ios swift 如何在更改语言时将 RTL 更改为 LTR View ?

转载 作者:搜寻专家 更新时间:2023-11-01 05:56:11 29 4
gpt4 key购买 nike

目前,我正在从事英语和阿拉伯语的本地化工作。要从 RTL View 更改为 LTR View ,我使用了 exit(0) 这将停止应用程序,用户必须再次打开它。为此,Apple 在上传到 App Store 时拒绝了我的申请。

我提到了 https://itunes.apple.com/us/app/talabat-for-ipad/id477430407?mt=8 ,它会在不退出应用程序的情况下更改 View 。

提前致谢。

最佳答案

您可以在调用 exit(0) 并再次设置窗口的 rootViewController 时使用外观代理更改 UIView 的 semanticContentAttribute

func switchViewControllers(isArabic arabic : Bool){

if arabic {
UIView.appearance().semanticContentAttribute = arabic ? .forceRightToLeft : .forceLeftToRight
let appDelegate = UIApplication.shared.delegate as? AppDelegate
let homeViewController = HomeViewController()
appDelegate?.window?.rootViewController = homeViewController
}
}

关于ios swift 如何在更改语言时将 RTL 更改为 LTR View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43369720/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com