Home > Mobile >  Features: 1. The most perfect lightweight image browser, image loading support the local network, yo
Features: 1. The most perfect lightweight image browser, image loading support the local network, yo

Time:09-17

# LXPhotosManagerModule

# # # # project introduction
* *

# # # the most perfect, the lightweight image management!
* *

# # # # installation instructions
Method 1: cocoapods installed library
* * pod 'LXPhotosManager'
Pod install * *

Method 2: * * direct download package decompression LXPhotosManager * * * * * *

The instructions on # # # #
* * after download please pod install package decompression in running the project * *

# # # model data must abide by the agreement FileInfoProtocol

` ` `
The class FileModel: FileInfoProtocol {
Var image: UIImage=UIImage ()
Var height: CGFloat=0.0
Var width: CGFloat=0.0
Var imgUrl: String=""
}
` ` `
# # # # scratchable latex display (WeChat friends pictures)

` ` `
Let photoVeiw=NineGridPhotosView (frame: CGRect (x: 0, y: 100, width: UIScreen. Main. The bounds, width, height: 600))
PhotoVeiw. Delegate=self
PhotoVeiw. LoadBlock={model, imgView in
ImgView. Kf. SetImage (with: URL (string: model. ImgUrl)!)
}
PhotoVeiw. The datasource=[model, model1 and model2, model3, model4]
The addSubview (photoVeiw)

` ` `
# # # # scratchable latex show pictures, click on the call browser (picture)

` ` `
Let pView=PhotosBrowserView ()
PView. ImgViews=[imgView imgView1, imgView2]
PView. LoadBlock={model, imgView in
ImgView. Kf. SetImage (with: URL (string: model. ImgUrl)!)
}
PView. Photos=[model, model1 and model2]
Let the index=[imgView, imgView1, imgView2]. FirstIndex (of: gesture. View)?? 0
PView. StartAnimation (with: index, cellType: false)

` ` `
# # # # UICollectionView click call image browser (picture)

` ` `
//picture browser
Let pView=PhotosBrowserView ()
PView. Delegate=self
PView. LoadBlock={model, imgView in
ImgView. Kf. SetImage (with: URL (string: model. ImgUrl)!)
}
PView. Photos=models
PView. StartAnimation (with: indexPath item, cellType: true)

//must implement proxy methods
The extension ViewController: PhotosBrowserViewDelagete {
Func photosBrowserView (cellIndex: Int, photos: [FileInfoProtocol]) - & gt; UIView {
Return collectionView. CellForItem (at: IndexPath (item: cellIndex, section: 0))?? UIView ()
}
}

` ` `
# # # #, click on the plus sign can choose album pictures or photos to delete pictures or web caching policy

` ` `
Let addView=AddPhotosView (frame: CGRect (x: 0, y: 100, width: UIScreen. Main. The bounds, width, height: 600))
AddView. Delegate=self
The addSubview (addView)
AddView. LoadBlock={model, imgView in
If model. IsNetWork {//network image z load
ImgView. Kf. SetImage (with: URL (string: model. ImgUrl)!)
} else {//album pictures load
ImgView. Image=model. The image
}
}
AddView. PubPhotoModels=models

//agent after selecting method of data source
Func addPhotosView (with a datasource: [FileInfoProtocol]) {
Print (datasource)
}
` ` `
* * rendering to show the effect of drag and gestures * *

See demo


! [effect] (https://images.gitee.com/uploads/images/2020/0413/210512_a13591d4_1890422.png "Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-13 at 21.01.36. PNG")
!/pack drag when rendering (https://images.gitee.com/uploads/images/2020/0413/210819_01e0de32_1890422.png "Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-13 at 21.07.25. PNG")
! [select add images] (https://images.gitee.com/uploads/images/2020/0419/233414_f2707dbd_1890422.png "Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-19 at 22.43.20. PNG")
  •  Tags:  
  • iOS