How to Implement Multipage Image Capture with User Interface
Note: Before you begin, see How to Add the Library to Your Xcode Project.
- Add the NSCameraUsageDescription and NSPhotoLibraryUsageDescription keys into the info.plist file for requesting access to the device’s camera and to the user’s photo library.
- Create an instance of the AUICaptureController interface for managing user interface and starting capture scenario. On this step you can use the properties of this interface to tune the user interface appearance and the settings of the camera.
- To get access to the processing mechanisms for chosen scenario create an RTREngine object using the sharedEngineWithLicenseData: method. The method requires an NSData object containing your license data. For example, you can use dataWithContentsOfFile: to create a data object, then pass this object to the sharedEngineWithLicenseData: method.
- Create an instance of an interface inherited from the AUICaptureScenario for managing the capture scenario. Choose the inherited interface for the multipage image capture scenario: AUIMultiPageImageCaptureScenario interface. Pass the previously created RTREngine object and a full path to a folder, that will be a page storage, as input parameters to the constructor.
- Use the properties of the AUIMultiPageImageCaptureScenario interface for flexible tuning of your application. I.e., depending on your application goal you can tune the presets of the scenario user interface and image count requirements:
- define the requiredPageCount property for fixing an exact number of images to be captured or allow unlimited image capture;
- to customize interface string resources, do the following:
- define custom string resources in the AUIMultiPageResourceType enumeration
- set these resources to the user interface setting using the captureScenario:stringForResourceType:forPageAtIndex: method of the AUIMultiPageUISettings protocol
- set the uiSettings property to the AUIMultiPageUISettings.
- Implement the delegate interface, corresponding to the scenario object, and its methods. I.e. for AUIMultiPageImageCaptureScenarioDelegate interface you should implement these methods:
- The captureScenario:didFinishWithResult: method returns the AUIMultiPageImageCaptureResult object providing access to the result images
- The captureScenario:onCloseWithResult: method notifies that the scenario was canceled by user
- The captureScenario:didFailWithError: method delivers error messages.
- Add the instance of the interface as a delegate property of the AUIMultiPageImageCaptureScenario object.
- Set the created scenario object as a captureScenario property of the AUICaptureController object. Scenario will start immediately at the camera start.
- If any error occurs while processing, the capture scenario becomes temporary passive and the paused property of the AUICaptureController object is set to true.
- Process the messages sent by scenario to the delegate object. The result will be delivered as an AUIMultiPageImageCaptureResult object providing access to the result images.
3/2/2022 12:59:15 PM