ios - UINavigationController 改变 InteractivePopGesture 方向
问题描述
我正在设计一个从右到左的应用程序。我通过使用这行代码完成了所有的 rtl:
UIView.appearance().semanticContentAttribute = .forceRightToLeft
这适用于所有期望我的导航控制器的交互式弹出手势的东西。segue的方向是正确的:
但是当我想使用弹出手势(从左边缘滑动到右边缘)时,视图从另一侧变得可见。
我应该如何改变它?
我尝试将边缘更改为 .right ,但这禁用了手势识别器:
let gesture = interactivePopGestureRecognizer as! UIScreenEdgePanGestureRecognizer
gesture.edges = .right
解决方案
您应该使用此扩展名更改 bothview
和navigationBar
语义属性:
extension UIViewController {
open override func awakeFromNib() {
super.awakeFromNib()
navigationController?.view.semanticContentAttribute = .forceRightToLeft
navigationController?.navigationBar.semanticContentAttribute = .forceRightToLeft
}
}
推荐阅读
- java - 从 json 元素中删除前缀并再次形成 json
- python - 在张量板 HPARAM 页面中显示最小值
- c# - JsonIgnore 来自父级的子属性
- python - 使用 Python 访问所有键,包括 JSON 中的列表
- javascript - ReactJS:函数发布axios错误:不是函数
- swift - 从 WKWebView 使用 NSPrintOperation
- ms-access - MsAccess 转换科学计数法
- javascript - 如何配置我的 index.js 文件以支持我的 react native 应用程序的乌尔都语、英语、荷兰语和其他语言
- reactjs - 添加基于 react json 模式表单下拉选择的属性
- javascript - 无法在其他 jquery 函数中绘制 jquery 饼图代码