qlpreviewcontroller 导航栏 - 如何将 pageCount 更改为字符串

qlpreviewcontroller navigation bar - How to Change pageCount to String

QLPreviewController navigationBar 标题显示当前页码,如第 2 页,共 6 页,但我想将此标题更改为任何字符串,如当前文件名。

试试这个

        let lblNavTitle = UILabel(frame: CGRect(x: 60, y: 10, width: view.frame.size.width-110, height: 20))
        lblNavTitle?.textAlignment = .center
        lblNavTitle?.lineBreakMode = .byTruncatingMiddle
        lblNavTitle?.text = "File Name"
        navigationItem.titleView = lblNavTitle

只需将标题 属性 设置为

self.title = "File Name"

可能对你有用