Book Image

iOS Application Development with OpenCV 3

By : Joseph Howse
4 (1)
Book Image

iOS Application Development with OpenCV 3

4 (1)
By: Joseph Howse

Overview of this book

iOS Application Development with OpenCV 3 enables you to turn your smartphone camera into an advanced tool for photography and computer vision. Using the highly optimized OpenCV library, you will process high-resolution images in real time. You will locate and classify objects, and create models of their geometry. As you develop photo and augmented reality apps, you will gain a general understanding of iOS frameworks and developer tools, plus a deeper understanding of the camera and image APIs. After completing the book's four projects, you will be a well-rounded iOS developer with valuable experience in OpenCV.
Table of Contents (13 chapters)
iOS Application Development with OpenCV 3
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Displaying an alert


To build a typical alert, we need a title, a message, and one or more action buttons. Each action button has a block of code that runs when the user presses the button.

As an example, let's study a helper method that displays an error popup with an OK button. When the user presses the OK button, the alert will be dismissed and the app will stop its busy mode. Here is the implementation:

- (void)showSaveImageFailureAlertWithMessage:(NSString *)message {
  UIAlertController* alert = [UIAlertController
    alertControllerWithTitle:@"Failed to save image"
    message:message preferredStyle:UIAlertControllerStyleAlert];
  UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"OK"
    style:UIAlertActionStyleDefault
    handler:^(UIAlertAction * _Nonnull action) {
      [self stopBusyMode];
    }];
  [alert addAction:okAction];
  [self presentViewController:alert animated:YES completion:nil];
}