Search code examples
iphoneiosuser-experienceexternal-accessory

A standard approach for disabling UI when application state changes


I have an iOS application that works with an external accessory connected through the dock connector. It is possible that the device may become disconnected during use of the application.

We have a Windows application that uses the same device and a message that says "Device Disconnected" on a partially opaque white background (so the view still shows through) when something like this occurs. When the device is plugged back in the message disappears.

Is an approach like this appropriate on iOS or is there a standard way of handling this situation?


Solution

  • If the application is not functional w/o the connected device i can't see why Apple would be against the warning and blocked UI.

    I'd not block the static UI completely not to give the impression of the hanged application. You can either add some simple animation or add the info button to avoid it.

    Two options to do it:

    1. simple for a single-window apps, a little dirty, very fast to implement:

      add the blocker view over the application key window

    2. doesn't depend on windows usage, clean, not so fast and could be hard to keep organized

      extend your navigation view controller (UINavigation controller or UITabBarController) or every viewController separately with such functionality.