IOS imitation WeChat QQ image selector imagePicker – just need to initialize and paste a view

Please see the GIT (with pod https://github.com/Assuner-Lee/LPDQuoteImagesView)

The latest addition to the pod

This library is encapsulated in TZImagePickerController

Pod’LPDQuoteImagesView’

# LPDQuoteImagesView

(iOS-imagePicker QQ –pickImage and quote imitation imitation WeChat) need only a few simple lines of code, you can choose photos and introduce reference function module photo (with a view, have all). All the functions are integrated into the black box, you need to do is to initialize the quoteview and quoteview have a picture array (camera, video).

This is posted up quoteView (picture 1 red rectangle)

IOS imitation WeChat QQ image selector imagePicker - just need to initialize and paste a view

This is quoteView affixed to the effect (red rectangle area), click to select or preview photos (set drag sort), click on the upper right corner (animation), can be removed by referencing the selectedPhotos attribute of the view UIImage array, save or transfer!

A brief introduction to the use (at present)

————————————————————————————-

1> import header file

#import “LPDQuoteImagesView.h”

———————————————————————————–

2> initialize a quoteImagesView (UIView type)

Eg: (assuming the initialization of a screen and almost the same view LPDQuoteImagesView *quoteImagesView =[[LPDQuoteImagesView alloc] initWithFrame:) CGRectMake (x, y, width, hight) withCountPerRowInView: 5 cellMargin: 12];

Initialize the view / / frame, view in each line number cell, cell space (such as Figure 1 above, cell is set according to the thumbnail size calculation)

QuoteImagesView.MaxSelectedCount = 6;

The maximum number of / / photo

QuoteImagesView.collectionView.ScrollEnabled = NO;

//view can slide

—————————————–

QuoteImagesView.navcDelegate = VC; / VC is a viewController (general VC refers to self, namely initialization in a controller)

/ / barely a delegate (commissioned controller pop imagePicker, but do not realize the delegate method, after can add some optional protocol method in some time to do something about the delegate object)

[aView addSubview: quoteImagesView];

We view to / / put a view on what all need not tube!!! (usually a view in the controller)

——————————————-

———————————————————————————–

3> get reference picture

NSArray < UIImage > = [NSArray * *imageArray arrayWithArray: quoteImagesView.SelectedPhotos];

The //selectedPhotos attribute is the collection of selected photos you see

Just paste / view and other selected photos in the library preview, save, update all thumbnails and do not need to rely on the new object in introducing no additional code, including collect view, all responses are sealed in the quoteview and the “black box”.

———————————————————————————–

Design sketch

Picture 2 (selected photo interface)

IOS imitation WeChat QQ image selector imagePicker - just need to initialize and paste a view
preview function

3 Preview

IOS imitation WeChat QQ image selector imagePicker - just need to initialize and paste a view

Selected photos, blue box and animation….

———————————————————————————–

Other features: the navigation bar automatically adapt to APP color, the other blue blue oval right, if you need other styles can be substituted in the bundle resource, the selected image thumbnails arranged can be set to change the position of the overall drag, delete with animation, add to the maximum number of not, delete.

The library is packaged in TZImagePickerController, a lot of business scenarios are very useful, thank you!

——————————————————————————-

——————————————————————————-

If you need to upload pictures, you must be NSData type, such as

NSArray< UIImage *> *imageArray = [NSArray arrayWithArray:_quoteImagesView.selectedPhotos];

Get / / photo array

NSMutableArray< NSData *> *imageDataArray = [[NSMutableArray alloc] init];

For (UIImage *imageObject in imageArray) {

NSData *imageData = UIImageJPEGRepresentation (imageObject, 0.3);

//UIImage convert to NSData

[imageDataArray addObject:imageData];

}

Then a NSData object can be placed in the post request formData upload

————————————————————————

Https://github.com/Assuner-Lee/LPDQuoteImagesView

If you feel good, do not forget to point a star Oh, thank you!!!!