LoginSignup
1
3

More than 5 years have passed since last update.

UIVideoEditorControllerの「保存」のテキスト変更

Posted at

UIVideoEditorControllerの右側のボタンが「保存」となっていたので変更したくて調査。

ラッパークラスを作成して、表示前に強引にボタンのタイトルを変更することで実装できたのでメモ。

UINavigationButtonっていうクラスだったが、
調べるとUIButtonを継承しているので、キャストしてタイトル変更。
ただ、もしかすると審査が通らないかもしれないので、審査通らなかったら諦めよう。

///
/// CstmVideoEditorController
///
class CstmVideoEditorController: UIVideoEditorController {
    ///
    /// will appear
    ///
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        for v in self.navigationBar.subviews {
            if v is UIButton {
                ///
                /// 右側のボタンか判定
                ///
                if v.frame.origin.x > self.view.w * 0.5 {
                    (v as! UIButton).setTitle("Done", for: UIControlState.normal)
                    (v as! UIButton).setTitle("Done", for: UIControlState.disabled)
                    (v as! UIButton).setTitle("Done", for: UIControlState.selected)
                    (v as! UIButton).setTitle("Done", for: UIControlState.highlighted)
                }
            }
        }
    }
}

もっといい方法あればコメント頂きたく。。。

m( _ _ )m

1
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3