Recipe: Modal Progress Overlays

Although UIAlertView and UIActionSheet provide straightforward communication and interaction with the user, you cannot add your own subviews. To provide a modal progress indicator, you must roll your own alert completely from scratch. Recipe 3-3 uses a simple tinted UIView overlay with a UIActivityIndicatorView.

As shown in Figure 3-4, the overlay view occupies the entire screen size. Using the entire screen lets the overlay fit over the navigation bar. The overlay view must be added to the application window and not, as you might think, to the main UIViewController’s view. That view only occupies the space under the navigation bar (the “application frame,” in UIScreen terms), allowing continued access to any ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.