qlpreviewcontroller导航栏-如何将pageCount更改为String

时间:2019-01-01 11:50:44

标签: ios swift qlpreviewcontroller

enter image description here

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

1 个答案:

答案 0 :(得分:0)

尝试

        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

OR

只需将标题属性设置为

self.title = "File Name"

也许对您有用