簡體   English   中英

在iOS9下的UIPageViewController中從左到右強制執行

[英]Force left to right in UIPageViewController under iOS9

我在我的應用程序中使用UIPageViewController ,因為iOS9已經發布,而我使用的是RTL語言,我的UIPageViewController已將其方向改為RTL。

我想強制UIPageViewController始終是LTR,即使系統語言是RTL。

在故事板中使用語義LTR不起作用。

不支持在視圖控制器上設置語義內容屬性。 歡迎您通過bugreport.apple.com提交增強請求。

您還可以繼續使用早期版本的Xcode並針對8.x SDK進行編譯。 這將禁用iOS 9中引入的所有RTL行為。

我發現這個解決方案:

if #available(iOS 9.0, *) {
    UIView.appearance().semanticContentAttribute = .ForceLeftToRight
} else {
    // Fallback on earlier versions
}

您可以在didFinishLaunchingWithOptions事件下的Appdelegate.swift文件中使用它。

viewDidLoad()委托方法中嘗試以下操作:

self.pageViewController!.view.semanticContentAttribute = .forceLeftToRight

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM