LoginSignup
3
5
100万人に伝えたい!失敗を乗り超えた話を共有しよう

iOS Simulatorでタップポインターを表示させる

Last updated at Posted at 2023-08-19

タップポインターを表示させてみた

sample01.gif

百聞は一見に如かず。先ずはこちらをご覧ください。
Simulatorでタップと同時にポインターが表示されます。

設定は何をすればいいの?

以下のコマンドをterminalで実行させてSimulatorを起動させる。

terminaで実行するコマンド
defaults write com.apple.iphonesimulator ShowSingleTouches 1

(※この時、Simulatorが立ち上がった状態のまま再度ビルドしてSimulatorを実行してもキャッシュが残っているので、ポインターは表示されない。Simlatorを完全に終了してから再起動する)

なぜ、表示・非表示になるのか?

com.apple.iphonesimulatorはSimulatorの設定を管理しているplistのことです。

こちらのplistにShowSingleTouches というKeyが存在しており、ValueにString(この場合は1)を入れることでSimlator上でタップポインターが発生します。

ポインター非表示にする。または戻す場合はShowSingleTouchesの値を0にします。
以下のコマンドをterminalで叩きます。

ポインター非表示にする
defaults write com.apple.iphonesimulator ShowSingleTouches 0

コマンドについて

defaults write com.apple.iphonesimulator ShowSingleTouches 1
上記のコマンドは何をしているのか分解して説明。

defaults write
アプリケーション設定の一覧表示と操作のコマンドでwriteで書き込みを意味しています。

com.apple.iphonesimulator ShowSingleTouches 1

こちらに関しては「com.apple.iphonesimulator.plist」の「ShowSingleTouches」というキーに「1」という値を書き込むということになります。

補足

defaultsのサブコマンドでreadを使用すればShowSingleTouchesのValueを確認することができます。

terminalで叩いてみよう
defaults read com.apple.iphonesimulator

または、Finderからでもポインター表示/非表示の設定が行えます。
基本は以下のパスを辿ればplistが存在しているはずです。Finderから移動して値を書き込むのでもOKです

 ~/Library/Preferences/com.apple.iphonesimulator.plist

↓↓このキーの値を設定すればポインター表示/非表示↓↓
image01.png

3
5
0

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
3
5