JNMultipleImages can be used to display multiple images in single view, it can be used in a newsfeed or posts. A single post can contain up to 4 displayed images, while showing a number with the remaining images if they are more than 4.
- iOS 9.0+ / macOS 10.10+
- Xcode 9.0+
- Swift 4+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate JNMultipleImages into your Xcode project using CocoaPods, specify it in your Podfile
:
use_frameworks!
target '<Your Target Name>' do
pod 'JNMultipleImages'
end
Then, run the following command:
$ pod install
-
Put some UIView and change the class to "JNMultipleImages"
-
Add refrence for it in the view controller.
-
Change Attributes:
- You can change count label attributes by accessing it directly from the JNMultipleImages reference.
- delegate : this delegate confirm to JNMultipleImagesViewDelegate.
- Call setup method:
Setup with JNImage array
func setup(images : [JNImage] , countLabelPosition : JNMultipleImagesCountLabelPosition , placeHolderImage : UIImage?, itemsMargin : CGFloat)
Setup with array of any which might be Url String or UIImage
func setup(images : [Any] , countLabelPosition : JNMultipleImagesCountLabelPosition , placeHolderImage : UIImage?, itemsMargin : CGFloat)
- images : The images array to load.
- countLabelPosition : The position for the count label (Fill view or fill last bottom right item).
- placeHolderImage : The placeholder image to use for failed images.
- itemsMargin : The margin between items.
The library will adjust the UIImageViews content mode automatically like the follows :
- If the image dimensions is smaller than the image view dimensions then the content mode is aspectFill
- If image width and height ratio less than the image view width and height ration then the content mode is aspectFill
- If the image is landscape and the image height is less than the image view height then the content mode is topRight
- Other than this it is aspectFit.
Jayel Zaghmoutt & Mohammad Nabulsi
JNMultipleImages is available under the MIT license. See the LICENSE file for more info.