Run Your App in the iOS Simulator

When you run your app, Xcode installs it on the iOS Simulator (or on a real device if you specified a device as the active SDK) and launches it. Using the Hardware menu and your keyboard and mouse, the Simulator mimics most of what a user can do on a real device, albeit with some limitations.

At first, the iPad Simulator looks like any iPad model would. If you were to click the Home button at the bottom center of the Simulator window once, you’d quit your app. The app would then appear on the Home screen with a standard blank icon. Click the blank icon once to launch the app again.

Interacting with your simulated hardware

Any simulator worth its salt has to be able to duplicate the actions you’d expect from a real device. The Xcode Simulator — no surprise here — can mimic a wide range of activities, all accessed from the Simulator Hardware menu. The Hardware menu items allow you to control various simulator behaviors, including:

  • Choose a device. Switch the simulated device to an iPad, any model iPhone, or the Retina display found on iPhone 4, iPhone 4S, and fourth-generation iPod touch models.

  • Choose a version. Switch to a different version of iOS.

  • Rotate left. Choosing Hardware→Rotate Left rotates the Simulator to the left. If the Simulator is in Portrait view, it changes to Landscape view; if the Simulator is already in Landscape view, it changes to Portrait view.

  • Rotate right. Choosing Hardware→Rotate Right rotates the Simulator to the right. Again, if the Simulator is in Portrait view, it changes to Landscape view; if the Simulator is already in Landscape view, it changes to Portrait view.

  • Use a shake gesture. Choosing Hardware→Shake Gesture simulates shaking the device.

  • Go to the Home screen. Choosing Hardware→Home does the expected — you go to the Home screen.

  • Lock the Simulator (device). Choosing Hardware→Lock locks the Simulator, which then displays the Lock screen.

  • Send the running app low-memory warnings. Choosing Hardware→Simulate Memory Warning fakes out your app by sending it a (fake) low-memory warning.

  • Simulate the hardware keyboard. Choose Hardware→Simulate Hardware Keyboard to check out how your app functions when the device is connected to an optional physical keyboard dock or paired with a Bluetooth keyboard.

  • Choose an external display. To bring up another window that acts like an external display attached to the device, choose Hardware→TV Out and then choose 640 x 480, 1024 x 768, 1280 x 720 (720p), or 1920 x 1080 (1080p) for the window’s display resolution. Choose Hardware→TV Ou@→Disabled to close the external display window.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com