未分類

Button押下時にTextFieldを起動させる方法

投稿日:

Buttonを押したActionで、TextFieldにフォーカスを当てて、キーボードを出したい。

textFieldにフォーカスを当てるにはbecomeFirstResponder()を使う。

 @IBAction func startDateButton(_ sender: Any) {
        
        startTextField.becomeFirstResponder()
        
    }

参考:【iOS】UITextField のキーボードを閉じる処理について

-未分類

執筆者:

関連記事

no image

NavigationControllerを用いた画面遷移

ViewControllerを選択→Editor→Embed In→NavigationController NavigationControllerとNavigationBarが出てくる。 View …

no image

PremiereProのテキストアニメーション簡単なやつ色々

・ぼかしからぼやっと出てくる エフェクト「ブラー(ガウス)」→開始でブラー値300、10フレーム後で0 参考:https://youtu.be/pamD-YrZGuY   ・1文字ずつ出てる …

no image

プロトコルの仕様書を見るコツ

プロトコルのデリゲートメソッドを確認したい。 プロトコル名をcommand+クリックJump to Definitionで設計図が見られる。 protocol UITableViewDelegateの …

no image

Firebaseがpodinstallできない原因

Firebaseのpod installを試みたが、何度やっても以下のエラーが出る。 [!] Unable to find a specification for `FireBase` You hav …

no image

Realmでモデル定義を変更した際に起こるエラーの対処法

Realmでモデル定義を変更するとエラーが出る。 マイグレーションをすることで解決する。 AppDelegate.swiftのfunc application(_ application: UIApp …