arc*_*att 14 button uiviewcontroller ios ios8 ios-app-extension
有没有办法更改SLComposeServiceViewController上的按钮标题?我试图更改导航项上的条形按钮项,但这些项不是正确的按钮.
Abh*_*jit 12
只需从navigationController访问!.navigationBar即可实现魅力.以下应该有所帮助.
self.navigationController!.navigationBar.topItem!.rightBarButtonItem!.title = "Save"
Run Code Online (Sandbox Code Playgroud)
我刚刚找到了一种方法:
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)
}
}
Run Code Online (Sandbox Code Playgroud)
请注意 - 这是一个脆弱的解决方案,基于未记录的内部结构SLComposeServiceViewController
| 归档时间: |
|
| 查看次数: |
1520 次 |
| 最近记录: |