1. Questions
Sometimes in iOS you need to select a local picture or take a photo, sometimes choose the photo when there will be multiple selection and a single, so you need to first package album selection, in the previous blog has also been written to the iOS multi-menu selection album Pictures. This is just the package for selecting pictures in the album. There are two ways in which we can select images in the app: one is through the photo album and one is through the camera. However, the problem arises again, each call to select a picture or to implement a single-select multiple selection and Uiimagepickercontroller, multiple calls will be implemented many times, so that the code is redundant, so it needs further optimization.
2. Analyzing problems
First, whether it is the package of single-choice multi-Select or the system to take pictures are to obtain the picture (function similar).
Second, the single-choice multi-choice and the system takes the photograph calls all is Viewcontroller
Three, are all through the page to obtain the picture system for the camera agent, single-choice multi-choice is block
3. Problem solving
Based on the above 3 points reminds me of a simple factory, can be further encapsulated, according to the parameters to generate a different Viewcontroller, page transfer is also a picture, the block and the agent to unify the same value method.
iOS Select Photo Optimizer