Change the button titles on SLComposeServiceViewController?

后端 未结 4 970
心在旅途
心在旅途 2021-01-04 05:05

Is there a way to change the button titles on the SLComposeServiceViewController? I tried to change the bar button items on the navigation item, but those aren\'t the right

4条回答
  •  情歌与酒
    2021-01-04 05:39

    I just found a way to do it:

    class CustomServiceViewController: SLComposeServiceViewController {
        override func viewDidLoad() {
            let navigationBar = view.subviews.first?.subviews?.last? as? UINavigationBar
            let postButton = navigationBar?.subviews.last? as? UIButton
            let cancelButton = navigationBar?.subviews.last? as? UIButton
            postButton?.setTitle("Done", forState: .Normal)
        }
    }
    

    Be warned - it's a fragile solution, based on undocumented internals of SLComposeServiceViewController

提交回复
热议问题